Re: the "hat" container class [C++]

From: Gerry Quinn (gerryq_at_DELETETHISindigo.ie)
Date: 05/29/04


Date: Sat, 29 May 2004 13:00:29 +0100

In article <c98eb501tnq@news4.newsguy.com>, mwojcik@newsguy.com says...
>
> In article <MPG.1b214e016f910486989682@news.indigo.ie>, Gerry Quinn <gerryq@DELETETHISindigo.ie> writes:
> >
> > Note that this is potentially an issue with ALL pseudo-random number
> > generators, however sophisticated. While some generators might not
> > return similar values at startup, any of them seeded with values from a
> > small range will return only a relatively small set of possible
> > sequences.
> >
> > I wonder how many of those who scorn rand() and insist on the benefits
> > of fancy pseudo-random generators are aware of this?
>
> Obviously, anyone who worries about a PRNG without understanding
> seeding is ignorant.

Like this person?
<<< QUOTE >>>
 (An aside: I don't have the post you quoted, but invoking rand
 twice and discarding the values after srand(time(NULL)) looks
 like cargo cult programming to me. I don't know what practical
 value it's meant to have.)
<<< END QUOTE >>>

> On the other hand, remarks like "any [generator] seeded with values
> from a small range will return only a relatively small set of
> possible sequences" suggest that perhaps the stones are not yours to
> throw.
>
> Clearly, the best any PRNG can do is generate as many sequences as
> there are possible seed values, where the "seed" is the portion of
> the PRNG's internal state that can be set by any mechanism outside
> the generator itself. That's all the entropy it has available to
> select a sequence. No need to waffle about "relatively small sets".

But if the seed value is set from a small range of values, the amount of
entropy theoretically available to the PRNG is largely irrelevant,
because only some of it is used. And automagically finding seeds much
better than the current time is non-trivial.

> I'd hope that most of the programmers sophisticated enough to know
> that there are choices of PRNGs would also understand this very basic
> concept. But I've been disappointed before.

A quick Google search shows that, by default, Mathematica seeds its
random number generator with the time of day. I think that is
sufficient proof that inadequate seeding is commonplace, perhaps the
norm.

But of course, we don't have to go as far as the Wolfram Institute to
prove this - your remark about "cargo cult programming" on this thread
demonstrated, as do the remarks to which I am now responding, that your
enthusiasm for pontification should be restrained until your knowledge
of the subject, at least in its practical aspects, is a little greater.

- Gerry Quinn

 



Relevant Pages

  • Re: Dynamic Hill cipher
    ... generators. ... For a linear PRNG with known coefficients, you get a system of linear ... The problem with such designs is as always: Designing a cipher is very ...
    (sci.crypt)
  • Re: the "hat" container class [C++]
    ... > Note that this is potentially an issue with ALL pseudo-random number ... > generators, however sophisticated. ... possible sequences" suggest that perhaps the stones are not yours to ... the best any PRNG can do is generate as many sequences as ...
    (comp.programming)
  • Re: numpy performance and random numbers
    ... a PRNG that have extremely high period like Mersenne Twister and puts ... Except there is no way to find two very distant states and prove they ... random generators - at least it is not obvious to me. ...
    (comp.lang.python)
  • Re: Pseudo Random Number Generator test results
    ... When I ran the PRNG that I was using through Diehard it is clearly not ... dup MyRandom! ... These type of random generators can be acceptable. ... For tForth Marcel Hendrix came up with a reference ...
    (comp.lang.forth)
  • Re: random_number
    ... The modern long period PRNGs have rather high order recurrences and rather large number of words of internal state. ... The quick and dirty is that the period length matches the seed size and can be much larger than the reported out value as shown by the multiple word seeds of the long period generators. ... So the classical order one PRNG is exactly uniform and can be pretty good up to six or so dimensions. ...
    (comp.lang.fortran)