SecureRandom with NativePRNG vs SHA1PRNG

TL;DR: Use new SecureRandom() when you’re not sure and let the system figure it out. Possibly use SecureRandom.getInstanceStrong() for long term key generation. Do not expect a random number generator to generate a specific output sequence within a runtime application, not even if you seed it yourself. With random number generators it is always hard … Read more

differences between random and urandom

Using /dev/random may require waiting for the result as it uses so-called entropy pool, where random data may not be available at the moment. /dev/urandom returns as many bytes as user requested and thus it is less random than /dev/random. As can be read from the man page: random When read, the /dev/random device will … Read more

What’s the origin of this GLSL rand() one-liner?

Very interesting question! I am trying to figure this out while typing the answer 🙂 First an easy way to play with it: http://www.wolframalpha.com/input/?i=plot%28+mod%28+sin%28x*12.9898+%2B+y*78.233%29+*+43758.5453%2C1%29x%3D0..2%2C+y%3D0..2%29 Then let’s think about what we are trying to do here: For two input coordinates x,y we return a “random number”. Now this is not a random number though. It’s the … Read more