Re: Random number generator without duplicates?
Re: Random number generator without duplicates?
- Subject: Re: Random number generator without duplicates?
- From: Chris Nebel <email@hidden>
- Date: Tue, 17 Apr 2001 13:40:36 -0700
- Organization: Apple Computer, Inc.
Bryan Harris wrote:
>
I notice after a few trials that the random number function is generating
>
duplicates after only a few iterations.
>
>
So just out of curiosity I generated 56 random numbers "from 1 to 56". Here
>
are the results:
>
>
* 39% (22) of the values were never generated
>
* 28% of the values were generated once
>
* 1 of the values was generated 4 times
>
>
Isn't the integer random number generator supposed to follow the same rules
>
as the real, i.e. generate every value once before repeating?
There is no such rule. If the generator reliably spat out every number from 1 to
n in just n iterations, it wouldn't really be random. That said, there are
problems in 1.5.5 and 1.6 with random integers coming out with different
frequencies. The endpoints (in this case, 1 and 56) tend to turn up out of
proportion to the others.
--Chris Nebel
AppleScript Engineering