Multiple Instance of rand?

A

are

Is it possible to have multiple instances Ruby's random-number
generator running within one program? I would like to have different
random sequences, each with its own seed.
 
J

Joel VanderWerf

are said:
Is it possible to have multiple instances Ruby's random-number
generator running within one program? I would like to have different
random sequences, each with its own seed.

Not yet, but it has been proposed for 1.9.

The best workaround for now is to use one of the external PRNG libraries.
 
A

are

Thanks much. I'm kind of a noob; could you please give me a hint as
to what the PRNG libraries are and where I would find them?
 
A

Axel Etzold

Thanks much. I'm kind of a noob; could you please give me a hint as
to what the PRNG libraries are and where I would find them?

A PRNG is a pseudo random number generator - "pseudo" here expresses the fact
that a computer is a deterministic device, so some tweaking is necessary
to make it difficult to predict the next "random" number ...


You can get an implementation for Ruby here:

http://rubyvm.sourceforge.net/subprojects/randomr/

Best regards,

Axel
 
K

khaines

Thanks much. I'm kind of a noob; could you please give me a hint as
to what the PRNG libraries are and where I would find them?

There is http://rubyforge.org/projects/crypt-isaac

ISAAC is a cryptographically secure PRNG (the mersenne twister, which is
what Ruby uses, produces quality streams of numbers, butis not
cryptographically secure).

That is a pure Ruby implementation. I have a version that has a C
extension that I have been sitting on for quite some time. I'll make some
time today to get that version packaged and uploaded, though.


Kirk Haines
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,310
Members
47,977
Latest member
MillaDowdy

Latest Threads

Top