21 lines
617 B
Python
21 lines
617 B
Python
|
import random
|
||
|
|
||
|
# Generowanie unikalnej losowej linii tekstu
|
||
|
def generate_unique_line(existing_lines):
|
||
|
while True:
|
||
|
line = ''.join(random.choice(['0', '1']) for _ in range(7))
|
||
|
last_digit = random.choice(['1', '2', '3', '0'])
|
||
|
line += last_digit
|
||
|
if line not in existing_lines:
|
||
|
return line
|
||
|
|
||
|
# Generowanie 200 unikalnych linii tekstu
|
||
|
lines = []
|
||
|
while len(lines) < 200:
|
||
|
line = generate_unique_line(lines)
|
||
|
lines.append(line)
|
||
|
|
||
|
# Zapisywanie linii tekstu do pliku
|
||
|
with open('decisionTree/database.txt', 'w') as file:
|
||
|
for line in lines:
|
||
|
file.write(line + '\n')
|