3 ms·
Some of these algorithms (eg. Knuth Shuffle) are implemented using Java's Random, as is their StdRandom helper class. While they do state their assumptions, I t
by jrabone 13y ago
Some of these algorithms (eg. Knuth Shuffle) are implemented using Java's Random, as is their StdRandom helper class. While they do state their assumptions, I think it's worth making the point that java.util.Random has traditionally been a pretty poor RNG (it was a simple 48 bit linear congruential generator with some appallingly non-random behaviour in the least significant bits). It might be better in Java 7 - I haven't looked. Anyone doing serious work with RNGs eg. for Monte Carlo sims would be advised to go elsewhere. I'm not talking about secure RNGs - that's a different ball game. Anyone doing crypto with java.util.Random has gone FAR beyond von Neumanns 'state of sin' ...
- electrum 13y agoAs the documentation for Random says: "Instances of java.util.Random are not cryptographically secure. Consider instead using java.security.SecureRandom to get a cryptographically secure pseudo-random number generator for use by security-sensitive applications."
- saucetenuto 13y agoRight, but it is (used to be?) dubious even for insecure applications.
- deleted 13y ago[deleted]