-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandom_Module.py
61 lines (41 loc) · 2.7 KB
/
Random_Module.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import random
value = random.random()
value1 = random.uniform(1,400) #random floating value betwee 1 to 10
print(value1)
val_int =random.randint(0,1)
print(val_int)
# random.choice
greetings = ['Hello' , 'Namaste' , 'Hi', 'Hey' , 'Hola']
values = random.choice(greetings)
print(values + ' JP')
# random .choices
Col_list = ['Red','Black' ,'Blue']
result = random.choices(Col_list , k= 10) # k = require sequence
result = random.choices(Col_list ,weights=[18,18,4], k= 10) # 18 is the chances of selection
print(result)
# .suffle() Method
deck_card = list(range(1,52))
random.shuffle(deck_card) # it can select duplicate value
print(deck_card)
# .samle method
hand_card = random.sample(deck_card, k=5) #chooses the unique sample number
print(hand_card)
#''' Super simple module to create basic random data for tutorials'''
import random
first_names = ['John', 'Jane', 'Corey', 'Travis', 'Dave', 'Kurt', 'Neil', 'Sam', 'Steve', 'Tom', 'James', 'Robert', 'Michael', 'Charles', 'Joe', 'Mary', 'Maggie', 'Nicole', 'Patricia', 'Linda', 'Barbara', 'Elizabeth', 'Laura', 'Jennifer', 'Maria']
last_names = ['Smith', 'Doe', 'Jenkins', 'Robinson', 'Davis', 'Stuart', 'Jefferson', 'Jacobs', 'Wright', 'Patterson', 'Wilks', 'Arnold', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson', 'Moore', 'Taylor', 'Anderson', 'Thomas', 'Jackson', 'White', 'Harris', 'Martin']
street_names = ['Main', 'High', 'Pearl', 'Maple', 'Park', 'Oak', 'Pine', 'Cedar', 'Elm', 'Washington', 'Lake', 'Hill']
fake_cities = ['Metropolis', 'Eerie', "King's Landing", 'Sunnydale', 'Bedrock', 'South Park', 'Atlantis', 'Mordor', 'Olympus', 'Dawnstar', 'Balmora', 'Gotham', 'Springfield', 'Quahog', 'Smalltown', 'Epicburg', 'Pythonville', 'Faketown', 'Westworld', 'Thundera', 'Vice City', 'Blackwater', 'Oldtown', 'Valyria', 'Winterfell', 'Braavos', 'Lakeview']
states = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']
for num in range(100):
first =random.choice(first_names)
last =random.choice(last_names)
phone = f'{random.randint(100,999)}-{random.randint(111,999)}-{random.randint(1000,9999)}'
street_num= random.randint(100,999)
street = random.choice(street_names)
state= random.choice(states)
city = random.choice(fake_cities)
zip_code = random.randint(10000,99999)
address = f'{street_num} {street} street., {city} {zip_code}'
email = first.lower() + last.lower() + '@randmgmail.com'
print(f'{first} {last} \n{phone}\n{address}\n{email}\n{state}\n')