In Python 2 documentation of the random.seed()
function I found a warning:
If a hashable object is given, deterministic results are only assured when PYTHONHASHSEED is disabled.
From http://ift.tt/2hMS8mz I infer that the -R
switch of the interpreter may have similar effect as PYTHONHASHSEED
.
I have verified empirically, that random numbers seeded with small integers seems to be reproducible. So do hashes of small integers.
However, int
is hashable. Is it stated explicitly in any trusted source, that it is safe to use it as a seed for a reproducible sequence of random numbers?
In contary to Reproducibility of python pseudo-random numbers across systems and versions?, reproducibility within same system and interpreter is enough.
Aucun commentaire:
Enregistrer un commentaire