Re: question about random generator



Robert Gamble wrote:
> Antonio wrote:
> > pete wrote:
> > > Does "pseudo-random" mean the same thing as "uniformly distributed" ?
> >
> > Completely OT, but anyway... No, pseudo-random means that it looks like
> > it's random but it really isn't. There is no way to generate trully
> > random numbers with a computer, everything you do is deterministic, but
> > you can generate sequences that look like they're random but that
> > aren't. Hence the term _pseudo_-random.
>
> Yes, we know, you didn't say anything that wasn't completely obvious.
> The C Standard specifies that rand() generates pseudo-random numbers,
> the questions is whether a conforming implementation could generate a
> series of normal distributed numbers via the rand() function or if the
> term pseudo-random implies that the numbers must be generated with a
> uniform distribution. I was wondering the same thing myself, I think
> the intention is that the numbers be uniform but that may be debatable.

It may be completely obvious to you, and to many people (including
myself), but it doesn't seem to be obvious to "pete", since he asked.
What I was trying to explain is that pseudo-random does not imply
anything about the distribution of the numbers. You may get
pseudo-random numbers that look like a uniform distribution, or
pseudo-random numbers that look like a poisson distribution, or a
gaussian distribution, or anything you want. In fact if you are able to
generate pseudo-random numbers with any distribution, you can operate
with them to obtain any other distribution you want.

On the topic of wether the standard requires the distribution to be
uniform. Well I don't know the standard by hard, but many people here
seem to have a copy of it, so it should be a simple matter to check it.
Every implementation I've seen of C and almost any other language/tool
generates pseudo-random number using a multiplicative seed, simply
becase it's a good enough method and requires relatively few
operations.

And finally, I don't know if an implementation that generated normally
distributed numbers with the rand() function would conform to the
standard, but it would be beyond foolish.

.



Relevant Pages

  • Re: question about random generator
    ... >> The C Standard specifies that randgenerates pseudo-random numbers, ... >> the intention is that the numbers be uniform but that may be debatable. ... > anything about the distribution of the numbers. ...
    (comp.lang.c)
  • Re: Question about tcp hash function tcp_hashfn()
    ... distribution, it can not end up in different results. ... Try a usable subset; no pseudo-random number generator. ... But its distribution might auto-correlate with the Jenkins function. ...
    (Linux-Kernel)
  • 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)
  • Re: Random number generator
    ... >> I wanted to find out if any of the pseudo-random number generator ... >> functions in MATLAB (e.g. rand, randn, etc) can be modified to solve ... >> I don't care about the distribution of the random numbers as long as ... > Peter Boettcher ...
    (comp.soft-sys.matlab)
  • Re: question about random generator
    ... The Standard doesn't actually guarantee any particular ... On the DeathStation 9000, rand() ... > distribution because doing so would require a lot of fairly ... IMHO, to have a footnote that mentions a uniform distribution, however ...
    (comp.lang.c)