Created
May 6, 2020 15:57
-
-
Save bbhavsar/506e73563580057f53a0489c54accb02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import sys | |
# 10M values to be generated | |
count = 10 * 1024 * 1024 | |
def gen_repeat_in_small_range(): | |
for i in range(0, int(count/256/256)): | |
for j in range(0, 256): | |
for k in range(0, 256): | |
print(j) | |
def gen_seq(): | |
for i in range(0, count): | |
print(i) | |
def gen_seq_in_small_range(): | |
for i in range(0, int(count/256)): | |
for j in range(0, 256): | |
print(j) | |
def gen_random(): | |
for i in range(0, count): | |
print(random.randint(0, count)) | |
def gen_random_in_small_range(): | |
for i in range(0, count): | |
print(random.randint(0, 256)) | |
sel = int(sys.argv[1]) | |
if sel == 1: | |
gen_repeat_in_small_range() | |
elif sel == 2: | |
gen_seq_in_small_range() | |
elif sel == 3: | |
gen_random() | |
elif sel == 4: | |
gen_random_in_small_range() | |
elif sel == 5: | |
gen_seq() | |
else: | |
raise "Invalid option" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment