Re: question about random generator



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.
.



Relevant Pages

  • Re: question about random generator
    ... The rand() function generates uniformly distributed ... distribution because doing so would require a lot of fairly ... matter -- certainly not a topic for the Standard to explicate. ... that it means "sort of uniform-ish in a sort of hand-waving way, ...
    (comp.lang.c)
  • Re: Confidence interval
    ... mean will be 0 and standard deviation is 1. ... distribution for tolerance limits and acceptability. ... Your opinion IS the method, whether you call it mathematical or not. ... Bayesian statistics is based on the PERSONAL or SUBJECTIVE ...
    (sci.stat.consult)
  • Re: random numbers from a lognormal distribution
    ... >Shouldn't that be "If X is a standard normal variate then ... and standard deviation from the normal distribution to the lognormal ... functions, and for any non-decreasing function g, the percentiles ... In particular, if m is the median of a normal distribution, then ln ...
    (sci.stat.math)
  • Re: Thoughts on some stdlib modules
    ... makes no sense to make the Python standard distribution like this. ... not an OS and cannot control all of the little factors that make package management feasible for ... As a side note, with the Numeric/numarray unification, the Numeric ...
    (comp.lang.python)
  • Re: question about random generator
    ... >>> uniform distribution. ... >> What I was trying to explain is that pseudo-random does not imply ... >> anything about the distribution of the numbers. ... Well I don't know the standard by hard, ...
    (comp.lang.c)