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 jfbu
Recipients jfbu, mark.dickinson, rhettinger, tim.peters
Date 2020-03-05.23:00:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583449234.64.0.135571531821.issue39867@roundup.psfhosted.org>
In-reply-to
Content
@tim.peters yes, a uniform random variable rescaled to two nearby scales N and M will display strong correlations. The CPython randrange() exhibits however orders of magnitude higher such correlations, but only in relation to a common bitlength. A randrange() function should a priori not be so strongly tied to the binary base.

The example you show would not be counted as a hit by my test for the randomseed 12.

>>> s = 0
>>> for t in range(100000):
...     random.seed(t)
...     x = [round(random.random() * 100) for i in range(10)]
...     random.seed(t)
...     y = [round(random.random() * 101) for i in range(10)]
...     if x == y:
...         s += 1
... 
>>> s
94
>>> s = 0
>>> for t in range(100000):
...     random.seed(t)
...     x = [random.randrange(100) for i in range(10)]
...     random.seed(t)
...     y = [random.randrange(101) for i in range(10)]
...     if x == y:
...         s += 1
... 
>>> s
90432
History
Date User Action Args
2020-03-05 23:00:34jfbusetrecipients: + jfbu, tim.peters, rhettinger, mark.dickinson
2020-03-05 23:00:34jfbusetmessageid: <1583449234.64.0.135571531821.issue39867@roundup.psfhosted.org>
2020-03-05 23:00:34jfbulinkissue39867 messages
2020-03-05 23:00:34jfbucreate