Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

truly random numbers?

Status
Not open for further replies.

LenLindquist

IS-IT--Management
Oct 17, 2002
31
US
I am writing a program that necessitates some special consideration for a bit more "random" numbers than PERL seems to provide by default. The catch is that I need to use ActivePerl's built-in capabilities only, and cannot use a downloaded module like Math::TrueRandom, e.g.

I can't seem to find anything that will allow me to read the hundredths of the second from the timer in PERL so I could do some simple srand() manipulation, either. Does anyone have some tips for getting some better randomization out of ActivePerl??

Thanks much,
Len Lindquist
 
Not entirely clear what you are trying to do(write your own routine for random numbers?-why not look at numerical recipes (you can view this on the web in C, F77, F90 and I think others and the random variable routine is fairly simple to code in any language).

With regard to time, have you looked at the module:

Time::HiRes

?(Ok, I run on linux, but it is probably available from activestate too)
Hope this helps, svar
 
well this works great for me.

int(rand(54)) + 1;
#gets a number between 1-54.
int(rand(10)) + 2;
#gets a number 2-12.


hope that helps.
zas-
 
SGI used to maintain a site which provided high-quality random number streams using CCD cameras pointed at a choir of Lava Lamps. The site is no longer available, though.

Another group is getting ready to do the same thing, and they're saying their site will come online in November 2002. Check out ______________________________________________________________________
TANSTAAFL!
 
For those of us that never saw lavaland.sgi.com what exactly is the concept behind it?

Thanks
Shelby
 
The concept was simple....

Set up a bunch of turned-on Lava Lamps in front of a set of CCD cameras. Use the processed digital data from the cameras as a source of random numbers.

The action of a Lava Lamp is analog and very random. It has been shown statistically that the number sequences of the system were of very high randomness.

At one time you could grab live images from the cameras as well as download files containing fresh random numbers from the system. File lengths up to (I think) 10 MB.

The numbers made great random number seeds for systems requiring very random numbers. ______________________________________________________________________
TANSTAAFL!
 
Thanks for all the help. The system I am writing requires a high level of randomness in the generated numbers.

The limitations are unfortunately, well, rather limiting.

Some users of the program may not be connected to the Internet and therefore may not be able to refresh a stream of generated random data from the Internet. (The lava lamps discussion was fascinating, however, and I'll check it out. I had no idea that was available.)

The other limitations, as previously mentioned, are that ActiveState PERL for Windows is being used and only its built-in capabilities may be employed to generate the solution.

So far the best I've been able to come up with is to seed the generator frequently with numbers based on the year, month, day, hours, minutes and seconds. I'd love to have access to hundredths of seconds, but I can't find a command or function that will allow access to that.

Can anyone help further?

Thanks much,
Len Lindquist
 
just out of curiosity, what on earth could you need such extreme "randomness" for? I certainly don't notice a parttern in the "regular" random numbers that perl generates.... not trying to be naive, I just don't completely understand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top