Re: random scatter
Re: random scatter
- Subject: Re: random scatter
- From: Chris Nebel <email@hidden>
- Date: Mon, 26 Feb 2001 12:27:45 -0800
- Organization: Apple Computer, Inc.
Daniel Shockley wrote:
>
> But all of the results were between 1E+12 and 1E+14 (in the tb range).
>
>
Interestingly enough, if the requested range was 1 through 1.0E+14, and you asked for 100
>
different random numbers, you most likely would get one or no numbers less than 1E+12, since there
>
are 100 times as many numbers in the group over 1E12. Think about it in terms of smaller numbers:
>
if you gave a range of 1 through 1e4, you'd expect that most of 100 results would be over 100,
>
right? There are 9900 numbers in that set above 100, and only 100 (of course) in the range 1
>
through 1e2.
Oh, duh. Daniel is spot on target here. The distribution R23 is seeing is normal. Mostly. There
is a problem in that "random number" internally generates a random 32-bit integer and then scales
that to fit the given range, so if the range is bigger than 4.2e12, you'll start getting gaps --
certain numbers will *never* show up. Of course, you'd have to run the generator for tens of
billions of times to notice.
To answer the "what was improved" question, there was a problem that similar large seed values (such
as you might get from the system clock) would return similar sequences of random numbers. Folks
usually discovered this by having a script to give them a random desktop picture at startup -- they'd
always get the same one.
--Chris Nebel
AppleScript Engineering