cross python version randomness
steve+python at pearwood.info
Tue Mar 21 07:51:03 EDT 2017
On Tue, 21 Mar 2017 08:30 pm, Robin Becker wrote:
> Looking in random.py it sesms to be true. Pity no backwards compatibility
> mode. I don't actually care about the quality of the ints produced, but I
> do care about reproducibility, luckily I think it's feasible to monkey
> patch the 2.7 method back in.
A few years ago I came across that, and raised it on the bug tracker. The
core devs decided that the backwards compatibility promise only applies to
the output of random.random() itself, not the assorted other methods.
If you care about the specific sequence of pseudo-random numbers generated
by a particular method across versions, you have to use your own
implementation. You can trust that random.random()'s output alone will be
reproducible, anything more than that you have to manage yourself.
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
More information about the Python-list