While I appreciate examining system calls, I feel like I must be missing something in TFA, because you can just seed your own instance of random.Random [0].<p>Trivial (and terrible) example – on every run past the first, the lists are identical:<p><pre><code> #!/usr/bin/env python3
import pickle
import random
SEED = 42
if __name__ == "__main__":
r = random.Random(SEED)
rand_l = None
new_rand_l = []
try:
with open("rand_list.dat", "rb") as f:
rand_l = pickle.load(f)
except FileNotFoundError:
pass
for i in range(100):
new_rand_l.append(r.randint(0, 1000))
if rand_l is not None:
assert rand_l == new_rand_l
else:
with open("rand_list.dat", "wb") as f:
pickle.dump(new_rand_l, f)
</code></pre>
[0]: <a href="https://docs.python.org/3/library/random.html#random.Random.seed" rel="nofollow">https://docs.python.org/3/library/random.html#random.Random....</a>