Generating a Secure Random Number : Secure Random « Security « Java Tutorial






import java.security.SecureRandom;

public class Main {
  public static void main(String[] argv) throws Exception {
    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");

    byte[] bytes = new byte[1024 / 8];
    sr.nextBytes(bytes);
  }
}








36.40.Secure Random
36.40.1.Secure Random Demo
36.40.2.Generating a Secure Random Number
36.40.3.Seed a Secure Random