Re: Yet more random number woes!
Re: Yet more random number woes!
- Subject: Re: Yet more random number woes!
- From: email@hidden (Tim Ramsey)
- Date: Sun, 13 Jun 2004 00:13:18 -0500
Darkshadow wrote:
>
On Jun 12, 2004, at 8:18 PM, April Gendill wrote:
>
>
> AHH! I'm ripping my hair out.
>
> ok.. I finally got it to where my random number generator generates
>
> the same numbers in the same sequence every time for any given seed.
>
> but if I switch from 10.3.4 to 10.2.3 the results are COMPLETELY
>
> different which leads me to believe that the results are different on
>
> every computer on the planet. this is a huge problem. Is there a way
>
> to lock down the results so that I get the same number on all
>
> machines?
>
>
>
> Thanks
>
> April.
A random number generator returns the same result given the same key.
The typical fundamental ones that I am familiar with comprise a few
simple assembly instructions on a fixed size integer word. To get a
repeatable sequence of draws, use the returned random value as the seed
for the next one and always start with the same seed. Many times this
will work across platforms because basic word sizes are the same and
because a small number of generators are commonly used. If you get
repeatable but different behaviors on two platforms, different
generators were used. You will have to provide your own RNG in that
case to get the same behavior. If you need one, email me off list, since
this isn't Cocoa.
>
>
>
>
Um...I don't have a solution, but doesn't this go against the idea of
>
random numbers? If you're trying to get the same set of numbers,
>
couldn't you just use the same set?
We think of them as random, but they are actually psuedo-random. They
have the same statistical properties as the actual random number (if
they are built right), but they are actually a repeatable series of
numbers with a very long repeat cycle. The most common reason for
wanting to get the same sequence of random numbers is for certain kinds
of testing where it is important to have cases replicate exactly.
>
>
I'm not all that surprised that the random number generator would come
>
up with different sets of numbers on different machines/OS versions.
>
Since the whole idea is to come up with random numbers, there's
>
probably not a whole lot of testing to see if the same seed would
>
generate the same sets...
>
>
Darkshadow (sometimes known as Mike Nickerson)
>
_______________________________________________
Generally, they are tested for three things: the right statistical
properties, long repeat cycle and absence of degenerate sequences. Only
developers of cross-platform compilers _might_ try for this kind of
repeatability. Most compilers rely on the system for the fundamental RNG, so
cross-platform repeatability can't be expected.
Tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.