[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: generating random numbers -- what seeds to use?

From: Paul Kienzle
Subject: Re: generating random numbers -- what seeds to use?
Date: Sun, 27 Apr 2003 22:00:31 -0400
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212

Mike Miller wrote:

I'd still like to run 10 jobs at once, but I'll have to supply initial
seeds.  Is there any way that I can guarantee that I won't produce the
same file twice?
Does your O/S have /dev/random?  Read the seed bits from there
if it does.  Otherwise, you could do something like xor the time with
the pid.

What is the best way to choose seeds?  What is the
period for Octave's random number generator?
According to libcruft/ranlib/README, the period is 2.3E18.

Has anyone developed other
random number generators for Octave?
rand/randn in octave-forge uses the Mersenne Twister
algorithm, and it is considerably faster.  It is also has
a very long period ( ~1E6000).

I made an oct-file implementation of Marsaglia's Ziggurat
code available in TOMS.  It is considerably faster than
randn.  I got no response when I asked him for license
clarification, so to redistribute it I will have to reimplement
the algorithm from the TOMS paper itself.  It's not too
difficult if someone has the interest, and the payoff is
certainly worthwhile if you need lots of normal numbers.
Send me a version for octave-forge if you implement it.

winrand has a fast Poisson generator which I have
implemented as an oct-file.  The author says the
code is public domain so no reason not to redistribute
it other than it is tied up in the same file as the ziggurat
code.  The winrand code has other generators as well,
but I haven't needed them.  Let me know if you are
interested and I will send you what I've got.

Gnu Scientific Library has a number of uniform
generators of various properties.  The normal and
poisson generators weren't particularly exciting.

Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]