Re: question about random generator
- From: "Antonio" <anconor@xxxxxxxxx>
- Date: 26 Jul 2005 12:25:05 -0700
Robert Gamble wrote:
> Antonio wrote:
> > 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.
>
> You are missing the point. The standard only states that the numbers
> generated are "pseudo-random", pete knows this, I know this, anyone who
> has a copy of the Standard knows this. He was specifically refering to
> this wording in the Standard and asking if this requirement alone
> implied a uniform disribution since the Standard does not discuss
> distribution requirements.
>
Then I have already answered your question. No, in no way pseudo-random
implies a uniform distribution. If the point is wether the creators of
the standard had a uniform distribution in mind when they phrased the
standard, well I wasn't one of them and AFAIK neither were you, so we
could talk for ages and still get to no conclusion.
If the standard just says that rand() generates pseudo-random integer
numbers between 0 and RAND_MAX >= 32767, then it says that, and only
that. If no reference to a certain distribution is made any
distribuiton would be valid. Of course the requirement that the values
must be within a certain range rules out lots of distributions
(poisson, gauss, Student-t, chi^2, cauchy...). So, from my POV, a
rand() function that returned 0 with p probability and 32767 with (1 -
p) probability would conform to the standard... while beeing almost
totally useless.
.
- 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: Antonio
- Re: question about random generator
- From: Robert Gamble
- Re: question about random generator
- From: Antonio
- Re: question about random generator
- From: Robert Gamble
- question about random generator
- Prev by Date: Re: Data structures question
- Next by Date: Re: Data structures question
- Previous by thread: Re: question about random generator
- Next by thread: Re: question about random generator
- Index(es):
Relevant Pages
|