-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgibberish.py
40 lines (31 loc) · 920 Bytes
/
gibberish.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
import string
from os import system
from random import choices, randint, choice
from sys import float_info
from sys import argv
from time import sleep
CHARSET = string.ascii_letters + string.digits + string.punctuation
def fast():
n = randint(72, 99)
line = "".join(choices(population=CHARSET, k=n))
print(line, end="", flush=True)
def slow():
print(choice(CHARSET), end="", flush=True)
def main():
system("cls") # clear stdout first
while True:
try:
if len(argv) == 1:
fast()
elif argv[1] in ["--slow", "-s"]:
slow()
elif argv[1] in ["--fast", "-f"]:
fast()
else:
print("Invalid option specification.")
raise Exception
sleep(float_info.min) # the slightest delay
except:
exit()
if __name__ == "__main__":
main()