You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
579 B
30 lines
579 B
# test urandom.seed() without any arguments
|
|
|
|
try:
|
|
import urandom as random
|
|
except ImportError:
|
|
try:
|
|
import random
|
|
except ImportError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
try:
|
|
random.seed()
|
|
except ValueError:
|
|
# no default seed on this platform
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
def rng_seq():
|
|
return [random.getrandbits(16) for _ in range(10)]
|
|
|
|
|
|
# seed with default and check that doesn't produce the same RNG sequence
|
|
random.seed()
|
|
seq = rng_seq()
|
|
random.seed()
|
|
print(seq == rng_seq())
|
|
random.seed(None)
|
|
print(seq == rng_seq())
|
|
|