Java Snippet – Using SecureRandom

by

in

A better random number generator
[java]
import java.security.SecureRandom;

public static SecureRandom random = null;
static {
try {
random = SecureRandom.getInstance(“SHA1PRNG”);
random.setSeed( random.generateSeed(256) );
} catch( Exception e ) {
e.printStackTrace();
}
}
[/java]


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *