Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

atmospheric noise and generating random numbers java

Tags:

java

random

noise

I was interested in finding out how one can use atmospheric noise to generate true random numbers. I know RANDOM.ORG does it but they (of course) don't explain what the process is and how it can be implemented. I would like to know how the process works and how it can be implemented into java. I have looked into this article but it's for .net so I don't understand it. I also looked into the RANDOM.ORG article on true randomness. If someone can give me a general idea of this works and how it can be implemented, it would be greatly appreciated.

like image 598
Jeel Shah Avatar asked Nov 28 '11 17:11

Jeel Shah


People also ask

How does atmospheric noise generate random numbers?

One source of randomness is atmospheric noise, the “static” generated by lightning discharges: world-wide, there are about 40 lightning flashes every second, which can be detected by an ordinary radio. Atmospheric noise produces numbers that pass all statistical checks for randomness.

How do you generate a random number from 1 to 5 in Java?

Java Random number between 1 and 10 Below is the code showing how to generate a random number between 1 and 10 inclusive. Random random = new Random(); int rand = 0; while (true){ rand = random. nextInt(11); if(rand != 0) break; } System.


3 Answers

From the random.org website:

In late 2009, RANDOM.ORG underwent a major restructuring in response to the increasing number of clients and their need for good reliability and performance. There is now a distributed configuration in which a number of nodes in different geographic locations generate randomness, subject it to statistical tests and then stream the distilled random bits to a cloud hosting service from which the RANDOM.ORG services run. This new architecture has increased the reliability as well as the performance of the service and helps make RANDOM.ORG suitable for the serious applications (e.g., lottery drawings) that are now offered. Tried and true, the random numbers are still generated with atmospheric noise, but the hardware and software used today is a long way from the $10 receiver from Radio Shack that started it all back in 1997.

They don't have pictures of the nodes that measure atmospheric noise, but they do have pictures of the radio noise nodes.

like image 45
Gilbert Le Blanc Avatar answered Sep 22 '22 22:09

Gilbert Le Blanc


Chances are good that if you bought a computer sometime in the past year, it has a true random number generator embedded directly in the CPU. This became available when Intel began shipping their Ivy Bridge-based Core and Xeon processors in April, 2012.

There's an excellent article in IEEE Spectrum that describes how Intel's digital random number generator works. They basically tied two NOT-gates into a loop, creating an inherently unpredictable circuit that settles into a 0 or 1 state due to the random effects of thermal noise. Thermal noise is just random atomic vibrations, which is pretty much the same underlying physical phenomenon that RANDOM.ORG uses when it samples "atmospheric noise".

For a truly in-depth analysis of Intel's RNG and the quality of its output, see this PDF document from Cryptography Research, particularly page 7.

Intel added a new x86 instruction called RDRAND that allows programs to directly retrieve these hardware-generated random numbers. As of Java 7, the JVM has yet to add native support for this instruction (if it ever will).

However, it is possible to invoke RDRAND from Java using JNI. This is the approach I took with the drnglib project. For example:

DigitalRandom random = new DigitalRandom();
System.out.println(random.nextInt());

The nextInt() method is implemented as a JNI native call that invokes RDRAND. Here's the relevant call stack:

  • C: RdRandEngine.rdrand32()
  • Java: RdRandEngine.engineNextInt()
  • Java: DigitalRandom.nextInt()

The performance of RDRAND is very good. Using drnglib with eight threads yields ~760 MB/sec of random data.

like image 121
cambecc Avatar answered Sep 23 '22 22:09

cambecc


You have to hook up a radio receiver into your machine (like this one: Philips FM1236/F TV Tuner/FM Radio/Video PCI Capture Card ).

Plug it into a free PCI Slot, you should be able to test its workings with some audio listening device (like VLC Player).

Then you tune it to a non-sending frequency and have your program connect to the device its representing to make a audio capture (the correct way to do so depends on the card you use, but this will help: http://docs.oracle.com/javase/tutorial/sound/capturing.html )

Then you process the audio capture, in the most simple way: store it as a wave onto your disk and read it byte per byte.

like image 25
Angelo Fuchs Avatar answered Sep 22 '22 22:09

Angelo Fuchs