Skip to content

Commit 9123711

Browse files
add input generator
1 parent ff3b307 commit 9123711

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

generate_input.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from random import choices
2+
from string import ascii_lowercase as letters
3+
4+
5+
def generate_random_input(lines_num, length_limit, file_path='input.txt'):
6+
chars, weights = list(letters) + [''], [1] * len(letters) + [len(letters)]
7+
8+
def babble(): return ''.join(choices(chars, k=length_limit, weights=weights))
9+
with open(file_path, 'w') as f:
10+
f.writelines('%s\n' % babble() for _ in range(lines_num))

0 commit comments

Comments
 (0)