generation function
This commit is contained in:
parent
cf00e72307
commit
d1e3d2c791
|
|
@ -1,4 +1,25 @@
|
|||
import time
|
||||
import random
|
||||
import linked_list as ll
|
||||
import hash_table as ht
|
||||
import bst
|
||||
import bst
|
||||
|
||||
def generate_records(n=10000):
|
||||
records =[]
|
||||
for i in range(n):
|
||||
name = f"User_{i:05d}"
|
||||
phone = f"+7{random.randint(9000000000, 9999999999)}"
|
||||
records.append((name, phone))
|
||||
|
||||
records_sorted = list(records)
|
||||
|
||||
records_shuffled = list(records)
|
||||
random.shuffle(records_shuffled)
|
||||
|
||||
return records_sorted, records_shuffled
|
||||
|
||||
print("Генерация данных")
|
||||
records_sorted, records_shuffled = generate_records()
|
||||
print(f"Данные готовы: {len(records_sorted)} элементов.")
|
||||
print(f"Пример (sorted): {records_sorted[:2]}")
|
||||
print(f"Пример (shuffled): {records_shuffled[:2]}")
|
||||
Loading…
Reference in New Issue
Block a user