-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.py
74 lines (57 loc) · 1.82 KB
/
functions.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
62
63
64
65
66
67
68
69
70
71
72
73
74
from random import randrange
from datetime import date
LastNames = open("./last-names.txt", mode="r", encoding="utf-8").read().splitlines()
MaleFirstNames = open("./male-first-names.txt", mode="r", encoding="utf-8").read().splitlines()
FemaleFirstNames = open("./female-first-names.txt", mode="r", encoding="utf-8").read().splitlines()
ReadMe = open("./README.md", mode="r", encoding="utf-8").read()
def GetReadMe():
return ReadMe
def getRandomNumber(start=0, end=1):
return randrange(start, end + 1)
def Seprator():
result = "." if getRandomNumber() == 1 else "_"
return result
def getDate():
return getRandomNumber(start=1, end=date.today().year)
def getNameOfMales():
return MaleFirstNames[getRandomNumber(0, len(MaleFirstNames) - 1)]
def getNameOfFemales():
return FemaleFirstNames[getRandomNumber(0, len(FemaleFirstNames) - 1)]
def getName(flag=0):
if flag == 0:
num = getRandomNumber(0, 2)
if num == 0:
return getNameOfMales()
elif num == 1:
return getNameOfFemales()
else:
return ""
elif flag == 1:
num = getRandomNumber(0, 1)
if num == 0:
return getNameOfMales()
else:
return ""
else:
num = getRandomNumber(0, 1)
if num == 0:
return getNameOfFemales()
else:
return ""
def getLastName():
return LastNames[getRandomNumber(0, len(LastNames) - 1)]
# 0 -> both
# 1 -> male
# 2 -> female
def CreateUser(flag=0):
user = getName(flag=flag)
user += Seprator()
user += getLastName()
if getRandomNumber(1, 10) <= 7:
user += str(getDate())
return user
def CreateSeveralUser(count=1, gender=0):
users = set()
while len(users) != count:
users.add(CreateUser(flag=gender))
return list(users)