[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2017-01-09 Thread STINNER Victor
STINNER Victor added the comment: Oh, sorry, I introduced the bug in Python 3.6 with the PEP 524 (os.urandom() now blocks on Linux). Too bad that there is no simple way to write an unit test for that. > ... but only on Windows on Python 3.6 With the bug, or when the fix when _PyOS_URandomNonb

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0a55e039d25f by Benjamin Peterson in branch '3.6': fix error check, so that Random.seed actually uses OS randomness (closes #29085) https://hg.python.org/cpython/rev/0a55e039d25f New changeset fc3eab44765f by Benjamin Peterson in branch 'default': m

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-28 Thread Eryk Sun
Eryk Sun added the comment: The secrets module uses SystemRandom, which overrides random() and getrandbits() to use os.urandom, so it's not affected. -- ___ Python tracker ___ _

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-28 Thread Brett Cannon
Changes by Brett Cannon : -- nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-28 Thread Brett Cannon
Brett Cannon added the comment: Does this affect the secrets module at all? -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-b

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Eryk Sun
Eryk Sun added the comment: > It's presumably failing to read nonblocking random from CrpytGen > and falling back to seeding using time and pid. Yes and no. CryptGenRandom is not failing, but it is nonetheless calling random_seed_time_pid: >>> r = random.Random() Breakpoint 0 hit

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Kyle Altendorf
Kyle Altendorf added the comment: time.sleep(0) and time.sleep(0.0) acted the same for me and both exhibited matching 'random' values in some cases. (win10, python3.6) I also printed time.time() with each 'random' value and it wasn't a perfect match but matching times tended to go with match

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ammar Askar
Ammar Askar added the comment: Can recreate under Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 and on latest master. -- nosy: +ammar2 versions: +Python 3.7 ___ Python tracker

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Donald Stufft
Donald Stufft added the comment: It's presumably failing to read nonblocking random from CrpytGen and falling back to seeding using time and pid. -- nosy: +dstufft ___ Python tracker __

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ned Batchelder
Ned Batchelder added the comment: Adding a time.sleep(0.001) (or maybe even just 0) between the calls prevents the problem. -- ___ Python tracker ___ ___

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Kyle Altendorf
Changes by Kyle Altendorf : -- nosy: +altendky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ned Batchelder
Changes by Ned Batchelder : -- versions: +Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue29085] Python 3.6 on Windows doesn't seed Random() well enough

2016-12-27 Thread Ned Batchelder
New submission from Ned Batchelder: 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 (