From fceef8f2454d64aec2fcb8f9cfd6e931b3ce034b Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 9 Feb 2012 22:00:27 -0800 Subject: [PATCH] pickrand.py: seed RNG with process ID Seed the random number generator with the current process ID rather than with the clock. Signed-off-by: Colin McCabe --- pickrand.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pickrand.py b/pickrand.py index 558115c..6340971 100755 --- a/pickrand.py +++ b/pickrand.py @@ -20,7 +20,7 @@ for root, dirs, files in os.walk("."): allfiles.append(os.path.join(root, f)) if (len(allfiles) == 0): sys.exit(1) -random.seed(None) +random.seed(os.getpid()) r = random.randint(0,len(allfiles) - 1) print(allfiles[r]) if (print_to_stderr): -- 1.6.6.rc1.39.g9a42