Skip to content

Instantly share code, notes, and snippets.

@cgundogan
Created June 20, 2018 15:46
Show Gist options
  • Save cgundogan/a1268454e07c73bc5c4c0369b88604dc to your computer and use it in GitHub Desktop.
Save cgundogan/a1268454e07c73bc5c4c0369b88604dc to your computer and use it in GitHub Desktop.
import java.security.SecureRandom;
import java.security.Security;
import java.util.Arrays;
public class SHA1PRNGTEST {
public static void main(String args[]) throws Exception {
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
random.setSeed(1);
int number = 0;
for (int i = 0; i < 20; i++) {
number = random.nextInt();
System.out.print(Integer.toUnsignedString(number) + " ");
}
System.out.println("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment