This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Truly Random Number Generator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Truly Random Number Generator" Watch "Java Truly Random Number Generator" New topic

Java Truly Random Number Generator

Paul Cowan

Joined: Nov 01, 2002
Posts: 9
While working on a Perl project, I came across the Math::TrulyRandom library that claims to be able to generate truely random number from reading interrupt timing discrepancies. Sounds like a very cool idea, which leads me to wonder if this is possible in Java. Has anyone seen a Java library that can do this? Seems like if you can do it in Perl, you should be able to do it in Java, (or C and use JNI to access it.)
... Or on top of that, anyone know what an interrupt timing discrepancy is? :roll:
As an aside, I ran across a serial port device which generates random bits from "two independent analogue Zener diode based noise sources". Costs like $650. (I think... the site is in Europe).
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Wow, how random do you have to get? I've heard of some high end encryption systems using electronic noise or heat variations to seed their RN generators. Pretty wild.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joe Ess

Joined: Oct 29, 2001
Posts: 9191

Originally posted by Paul Cowan:
... Or on top of that, anyone know what an interrupt timing discrepancy is? :roll:

Anything that triggers an interrupt (activity on the keyboard, mouse, disk, network and so on) is assumed to occur with a random period, so one compiles that information as it occurs for later use. On Linux, this pool is stored in /dev/random, so to use it in Java, just open that pool as you would any file.

[How To Ask Questions On JavaRanch]
Paul Cowan

Joined: Nov 01, 2002
Posts: 9
Ahh, very cool. Thanks! I always though /dev/random was more complicated than that.
Chris De Vries
Ranch Hand

Joined: Dec 05, 2002
Posts: 65
You can obtain random number manually or automatically through a java program from They accept HTTP or CORBA connections.
I agree. Here's the link:
subject: Java Truly Random Number Generator
It's not a secret anymore!