Java Snippet - Using SecureRandom
A better random number generator
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();
}
}
About this entry
You’re currently reading “Java Snippet - Using SecureRandom,” an entry on Weblog of Michael Cutler
- Published:
- 17th May 2005 / 10:05pm
- Category:
- Java
No comments
Jump to comment form | comments rss [?] | trackback uri [?]