1# test urandom.seed() without any arguments 2 3try: 4 import urandom as random 5except ImportError: 6 try: 7 import random 8 except ImportError: 9 print("SKIP") 10 raise SystemExit 11 12try: 13 random.seed() 14except ValueError: 15 # no default seed on this platform 16 print("SKIP") 17 raise SystemExit 18 19 20def rng_seq(): 21 return [random.getrandbits(16) for _ in range(10)] 22 23 24# seed with default and check that doesn't produce the same RNG sequence 25random.seed() 26seq = rng_seq() 27random.seed() 28print(seq == rng_seq()) 29random.seed(None) 30print(seq == rng_seq()) 31