pickrand.py: seed RNG with process ID
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 10 Feb 2012 06:00:27 +0000 (22:00 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 10 Feb 2012 06:00:27 +0000 (22:00 -0800)
Seed the random number generator with the current process ID rather than
with the clock.

Signed-off-by: Colin McCabe <cmccabe@alumni.cmu.edu>

pickrand.py

index 558115c..6340971 100755 (executable)
@@ -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):