import random from typing import List, Tuple def generate_data(n=10000): records = [] for i in range(n): name = f"User_{i:05d}" phone = f"8{random.randint(900,999)}{random.randint(100,999)}{random.randint(0,9)}{random.randint(0,9)}{random.randint(0,9)}{random.randint(0,9)}" records.append((name,phone)) records_shuffled = records.copy() random.shuffle(records_shuffled) records_sorted = sorted(records, key=lambda x:x[0]) return records_shuffled, records_sorted def generate_search(records, exist_count=100, no_exist_count=10): exist_names = [name for name, _ in records] select_exist = random.sample(exist_names, min(exist_count, len(exist_names))) no_exist_count=[f"None_{i:05d}" for i in range(no_exist_count)] return select_exist + no_exist_count def generate_delete(records, count=50): names = [name for name, _ in records] return random.sample(names, min(count, len(names)))