[Python-ideas] Python's Source of Randomness and the random.py module Redux

Chris Angelico rosuav at gmail.com
Thu Sep 10 19:11:19 CEST 2015

On Fri, Sep 11, 2015 at 3:00 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> As far as the proposed Seeded/Seedless naming goes, that deliberately
> glosses over the fact that "seed" gets used to refer to two different
> things - seeding a PRNG with entropy, and seeding a deterministic PRNG
> with a particular seed value. The key is that "SeedlessRandom" won't
> have a "seed()" *method*, and that's the single most salient fact
> about it from a user experience perspective: you can't get the same
> output by providing the same seed value, because we wouldn't let you
> provide a seed value at all.

Aside from sounding like varieties of grapes in a grocery, those names
seem just fine. From the POV of someone with a bit of comprehension of
crypto (as in, "use /dev/urandom rather than a PRNG", but not enough
knowledge to actually build or verify these things), the distinction
is precise: with SeededRandom, I can give it a seed and get back a
predictable sequence of numbers, but with SeedlessRandom, I can't. I'm
not sure what the difference is between "seeding a PRNG with entropy"
and "seeding a deterministic PRNG with a particular seed value",
though; aside from the fact that one of them uses a known value and
the other doesn't, of course. Back in my BASIC programming days, we
used to use "RANDOMIZE TIMER" to seed the RNG with time-of-day, or
"RANDOMIZE 12345" (or other value) to seed with a particular value;
they're the same operation, but one's considered random and the
other's considered predictable. (Of course, bytes from /dev/urandom
will be a lot more entropic than "number of centiseconds since
midnight", but for a single-player game that wants to provide a
different starting layout every time you play, the latter is


More information about the Python-ideas mailing list