Simplified arithmetic in Python batch tester program, without changing behavior.

This commit is contained in:
Project Nayuki 2017-09-09 04:12:28 +00:00
parent ad46d5e434
commit 048a126119
1 changed files with 4 additions and 4 deletions

View File

@ -72,16 +72,16 @@ def main():
def do_trial():
mode = random.randrange(4)
if mode == 0: # Numeric
length = max(round((2 * 7089) ** random.random()), 1)
length = round((2 * 7089) ** random.random())
data = [random.randrange(48, 58) for _ in range(length)]
elif mode == 1: # Alphanumeric
length = max(round((2 * 4296) ** random.random()), 1)
length = round((2 * 4296) ** random.random())
data = [ord(random.choice("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")) for _ in range(length)]
elif mode == 2: # ASCII
length = max(round((2 * 2953) ** random.random()), 1)
length = round((2 * 2953) ** random.random())
data = [random.randrange(128) for _ in range(length)]
elif mode == 3: # Byte
length = max(round((2 * 2953) ** random.random()), 1)
length = round((2 * 2953) ** random.random())
data = [random.randrange(256) for _ in range(length)]
else:
raise AssertionError()