Author nedbat
Recipients nedbat
Date 2016-12-27.17:39:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1482860364.41.0.203895591313.issue29085@psf.upfronthosting.co.za>
In-reply-to
Content
Creating two Random() instances in quick succession produces the same sequence, but only on Windows on Python 3.6.  On 3.5 or earlier, or on Mac/Linux, the randomization is good.

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import random; print(random.Random().randint(1, 999999), random.Random().randint(1, 999999))
903885 903885
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(2)])
996947 56476
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(2)])
793282 793282
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(2)])
519702 519702
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(2)])
230678 230678
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(3)])
474701 474701 474701
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(3)])
890942 890942 890942
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(3)])
997495 997495 997495
>>> import random; print(*[random.Random().randint(1, 999999) for _ in range(5)])
27803 27803 27803 27803 919401
>>>

I would expect each of these runs to produce unique numbers, with no duplicates.
History
Date User Action Args
2016-12-27 17:39:24nedbatsetrecipients: + nedbat
2016-12-27 17:39:24nedbatsetmessageid: <1482860364.41.0.203895591313.issue29085@psf.upfronthosting.co.za>
2016-12-27 17:39:24nedbatlinkissue29085 messages
2016-12-27 17:39:23nedbatcreate