import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
public class Main {
public static void main(String[] args) throws NoSuchAlgorithmException {
SecureRandom srand = SecureRandom.getInstance("NativePRNG");
System.out.println(srand.nextInt());
}
}
How to run with NativePRNG on windows?
UPD:
By default, in Java 10+, \<JDK>\conf\security\java.security
file,
crypto.policy=unlimited
. sp nothing need to be changed for Java 10+ in java.security file.
And to use NativePRNG
algorithm, we can change it to Windows-PRNG
.
SecureRandom srand = SecureRandom.getInstance("Windows-PRNG");
System.out.println(srand.nextInt());