Re: Random number generation to comply with a standard deviation



On 2006-11-13 18:24:33 -0400, "John Burns" <johnburns007@xxxxxxxxx> said:

Gordon,
Thanks for your quick reply.
I was hoping not to get too much into the details of the random
generation as the random side of this is supposedly very minor in the
big picture.
I started with John Conway's Game of Life and have modified the rules
somewhat to allow for a life of a cell which is calculated at birth
using this random number generation (hence wanting the lifespan of a
cell to fit into a bell shaped curve). Using these rules I'm building
high resolution color images of the output.
It looks like I've bitten off more than I can chew and will have to
dive into the depths of random number generators.

Once again thanks for the brief but very useful message.

John


That sounds like the distibution is changing depending upon the history.
Rather different slant that your original story. Your problem will be
figuring out the distribution and not the actual drawing from whatever
the distribution is.


Gordon Sande wrote:
On 2006-11-13 11:01:40 -0400, "John Burns" <johnburns007@xxxxxxxxx> said:

Hi all,
this is the first time I've been to this group, but from what I have
searched, this question has never come up.

I'm trying to write some code that generates pseudo-random numbers that
comply with a stanard deviation.

I know how to do this in reverse, getting a sample and finding out the
standard deviation, but how in the world can I generate random numbers
which will over time comply with a standard deviation.

I've created a bit of a nasty hack which tracks all previously
generated numbers, works out the SD and then modifies the random number
generator to bias the curve, but this gets very slow once a couple of
million random numbers have been generated which need tracking - In my
case I want to be able to produce billions of numbers so would rather
not have to log them.

Any ideas, or keywords to search for?

Regards

John

The typical random Gaussian generator has mean zero and standard deviation 1.

To get Gaussians of mean 10 and standard deviation 1 you add 10 to the
generator.
To get Gaussinas of mean 0 and standard deviation 10 you multiply the
generator
by 10.
To get Gaussians of mean m and standard deviation s you multiply by s and add m
to the generator.
And so on.

The recipe for other distributions will be similar. Generators for other
than uniform and Gaussian tend to be a bit less common and would require
looking for one of the common libraries rather than just taking whatever
the language/system provides.

Or is your problem that you want the sample's standard deviation to be exactly
some specified value rather than whatever a sample from the distribution
happens to provide? If you really are in the billions of random numbers regime
a broader knowledge of random number generation than seems apparent from the
question would seem to be warranted. Try Knuth Vol 2. Or a book on
computational
statistics.


.



Relevant Pages