Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
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] ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40682> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com