new SecureRandom() : SecureRandom « java.security « Java by API






new SecureRandom()

 
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;

/*

 */
public class MainClass {
  public static void main(String[] unused) {
    Random prng = new SecureRandom();  // self-seeding
    System.out.println(BigInteger.probablePrime(10, prng));
    }
 

}

           
         
  








Related examples in the same category

1.SecureRandom: getInstance(String algorithm) throws NoSuchAlgorithmException
2.SecureRandom: nextBytes(byte[] bytes)
3.SecureRandom: setSeed(long seed)