Re: question about random generator
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 26 Jul 2005 20:19:21 GMT
Eric Sosman <esosman@xxxxxxxxxxxxxxxxxxx> writes:
> pete wrote:
[...]
>> Does "pseudo-random" mean the same thing as "uniformly distributed" ?
>
> No. The Standard doesn't actually guarantee any particular
> distribution from rand(). On the DeathStation 9000, rand()
> returns 42 every time you call it.
>
> I've always assumed that the Standard doesn't describe the
> distribution because doing so would require a lot of fairly
> deep mathematics; Knuth devotes thirty-five pages to the topic
> "What is a random sequence?" Developing a useful theory of
> the randomness of finite sequences is (it seems) no simple
> matter -- certainly not a topic for the Standard to explicate.
> So the Standard just says "pseudo-random," and we all understand
> that it means "sort of uniform-ish in a sort of hand-waving way,
> noodge noodge wink wink."
>
> Anyhow, that's how I've imagined the committee's intent.
> The Rationale sheds no further light on the matter, either.
The Standard says that rand() "computes a sequence of pseudo-random
integers in the range 0 to RAND_MAX". Though it doesn't explicitly
say how they're distributed, I don't think anything other than a
uniform distribution would make any sense. If a normal distribution
were intended, integers in the range 0 to RAND_MAX would be an odd way
to specify it.
Also, the sample implementation yields a more or less uniform
distribution.
It's debatable (but *not* usefully debatable!) whether the DS9K's
implementation of rand() is conforming. It would have been nice,
IMHO, to have a footnote that mentions a uniform distribution, however
handwavingly.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- question about random generator
- From: Marc Dansereau
- Re: question about random generator
- From: Eric Sosman
- Re: question about random generator
- From: Peter Nilsson
- Re: question about random generator
- From: Eric Sosman
- Re: question about random generator
- From: pete
- Re: question about random generator
- From: Eric Sosman
- question about random generator
- Prev by Date: Re: Should function argument be changed in function body?
- Next by Date: Re: Ordered output without "sorting" array
- Previous by thread: Re: question about random generator
- Next by thread: Re: question about random generator
- Index(es):
Relevant Pages
|