This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients mark.dickinson, mrled, rhettinger, steven.daprano
Date 2020-05-20.00:28:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589934513.86.0.371839512309.issue40682@roundup.psfhosted.org>
In-reply-to
Content
The parts that are supposed to be stable are the seeding and the output of calls to random().  The sessions shown below show that this working as intended.

The downstream algorithms such as randrange() are not protected by the reproducibility guarantees.  While we try not to change them unnecessarily, they are allowed to change and to generate different sequences.  

At some point in Python 3's history, we changed randrange() so that it often gives different results than before.  The reason for the change is that the old algorithm wasn't as evenly distributed as it should have been.

------ Sessions showing that the output of random() is stable ------

Python 2.7.17 (v2.7.17:c2f86d86e6, Oct 19 2019, 16:24:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> import random
>>> random.seed('superman123')
>>> [random.random() for i in range(5)]
[0.6740635277890739, 0.3455289115553195, 0.6883176146073614, 0.3824266890084288, 0.9839811707434662]

Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> import random
>>> random.seed('superman123', version=1)
>>> [random.random() for i in range(5)]
[0.6740635277890739, 0.3455289115553195, 0.6883176146073614, 0.3824266890084288, 0.9839811707434662]
History
Date User Action Args
2020-05-20 00:28:33rhettingersetrecipients: + rhettinger, mark.dickinson, steven.daprano, mrled
2020-05-20 00:28:33rhettingersetmessageid: <1589934513.86.0.371839512309.issue40682@roundup.psfhosted.org>
2020-05-20 00:28:33rhettingerlinkissue40682 messages
2020-05-20 00:28:33rhettingercreate