-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrandomized_input.py
More file actions
37 lines (30 loc) · 868 Bytes
/
randomized_input.py
File metadata and controls
37 lines (30 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import random
def randomized_site_list(n):
common = ["google", "google", "google", "yahoo", "aol", "facebook", "facebook", "cnn", "bbc"]
result = []
for i in range(0,n):
choose_common = random.randint(0,1)
if (choose_common == 1):
common_index = random.randint(0,len(common)-1)
result.append(common[common_index])
else:
result.append("rare_" + str(random.random()))
return result
def randomized_user_list(n,k):
result = []
for i in range(0,n):
result.append("user_" + str(random.randint(0,k-1)))
return result
if (len(sys.argv) > 1):
num_lines = int(sys.argv[1])
else:
num_lines = 100
if (len(sys.argv) > 2):
num_users = int(sys.argv[2])
else:
num_users = 10
site_list = randomized_site_list(num_lines)
print(site_list)
user_list = randomized_user_list(num_lines, num_users)
print(user_list)