This repository was archived by the owner on Aug 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_generation.py
More file actions
47 lines (41 loc) · 1.32 KB
/
data_generation.py
File metadata and controls
47 lines (41 loc) · 1.32 KB
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
"""
Generates random data for analysis
"""
import random
import encrypt
def random_write():
"""
takes user input as to number of generated values
saves generated data to DB
:return:
"""
# gets user input as to number of values to be generated
count = int(input("Data points?"))
# opens DB
coredb = open("data" + "/coredb.txt", "a")
for i in range(0, count):
output_str = ''
output_array = []
# runs generation
arr = random_gen()
for j in range(0, len(arr)):
output_array.append(arr[j])
for k in range(0, len(output_array)):
output_str += ''.join(encrypt.shift_encode(''.join(output_array[k]), 5))
output_str += '.'
# print(output_str)
coredb.write(output_str)
coredb.write('\n')
def random_gen():
"""
selects data to be randomly generated
:return:
"""
players = ["tad", "eric", "john", "simon", 'erica', 'samantha']
venues = ["epsom", "guards"]
ponies = ["dora", "simpatico", "elana", "horace", "dagny", "heel", "india"]
# selects values to add to output array, randomly
arr = [players[random.randint(0, 3)], venues[random.randint(0, 1)], ponies[random.randint(0, 6)],
str(random.randint(1, 8)), str(random.randint(0, 3))]
return arr
random_write()