Most likely, if you bought a computer in the last year, it has a real random number generator built directly into the CPU. This became available when Intel began shipping its Core and Xeon processors with Ivy Bridge > processors in April 2012.
There's a great article on the IEEE Spectrum that describes how Intel's digital random number generator works. They basically tied two NOT gates into a loop, creating an unpredictable pattern that settles to state 0 or 1 due to random effects of thermal noise. Thermal noise is just random atomic vibrations, which is pretty much the same basic physical phenomenon that RANDOM.ORG uses when it displays “atmospheric noise”.
For a truly in-depth analysis of Intel RNG and its product quality, see this PDF document from Cryptographic Research , especially on page 7.
Intel has added a new x86 instruction called RDRAND , which allows programs to directly extract these hardware random numbers. Starting with Java 7, the JVM has not yet added native support for this instruction (if it ever will be).
However, you can use RDRAND from Java using JNI. This is the approach I took with the drnglib project. For instance:
DigitalRandom random = new DigitalRandom(); System.out.println(random.nextInt());
The nextInt() method is implemented as an internal JNI call that calls RDRAND. Here's the appropriate call stack:
RDRAND performance is very good. Using drnglib with eight threads yields ~ 760 MB / s of random data.
source share