mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
27
tests/extmod/random_seed_default.py
Normal file
27
tests/extmod/random_seed_default.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# test random.seed() without any arguments
|
||||
|
||||
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())
|
||||
Reference in New Issue
Block a user