2018-07-22 15:19:22 +01:00
|
|
|
try:
|
|
|
|
import urandom as random
|
|
|
|
except ImportError:
|
|
|
|
try:
|
|
|
|
import random
|
|
|
|
except ImportError:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
|
|
|
|
|
|
|
try:
|
|
|
|
random.randint
|
|
|
|
except AttributeError:
|
2020-03-23 02:26:08 +00:00
|
|
|
print("SKIP")
|
2018-07-22 15:19:22 +01:00
|
|
|
raise SystemExit
|
|
|
|
|
2020-03-23 02:26:08 +00:00
|
|
|
print("random")
|
2018-07-22 15:19:22 +01:00
|
|
|
for i in range(50):
|
|
|
|
assert 0 <= random.random() < 1
|
|
|
|
|
2020-03-23 02:26:08 +00:00
|
|
|
print("uniform")
|
2018-07-22 15:19:22 +01:00
|
|
|
for i in range(50):
|
|
|
|
assert 0 <= random.uniform(0, 4) <= 4
|
|
|
|
assert 2 <= random.uniform(2, 6) <= 6
|
|
|
|
assert -2 <= random.uniform(-2, 2) <= 2
|