Skip to content

Commit

Permalink
A better way to get good random numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Dec 27, 2016
1 parent 7bb4266 commit 5b66bcb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions coverage/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import random
import re
import socket
import time

from coverage import env
from coverage.backward import iitems, string_class
Expand Down Expand Up @@ -666,9 +665,7 @@ def write(self, data, suffix=None):
with open(_TEST_NAME_FILE) as f:
test_name = f.read()
extra = "." + test_name
if env.WINDOWS:
time.sleep(0.001) # Yuk: http://bugs.python.org/issue29085
dice = random.Random().randint(0, 999999)
dice = random.Random(os.urandom(8)).randint(0, 999999)
suffix = "%s%s.%s.%06d" % (socket.gethostname(), extra, os.getpid(), dice)

if suffix:
Expand Down

0 comments on commit 5b66bcb

Please sign in to comment.