jfbu <j...@free.fr> added the comment:
@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 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39867> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com