import os
import random
# Get the project root by moving up two levels from the current file
PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
NUM_DATASETS = 12 # Number of datasets to generate for each input size
# Map each directory to the corresponding number of random integers to generate
sizes = {
"size_10000": 10000,
"size_20000": 20000,
"size_40000": 40000,
"size_80000": 80000,
"size_100000": 100000,
"size_200000": 200000,
"size_400000": 400000,
"size_800000": 800000,
}
# Iterate over each size and create corresponding datasets
for dir_name, input_size in sizes.items():
# Create subdirectory for each size
subdir_path = os.path.join(PROJECT_ROOT, "data", dir_name)
os.makedirs(subdir_path, exist_ok=True) # Ensure the directory exists
# Generate the specified number of datasets
for i in range(1, NUM_DATASETS + 1):
# Create the full path to the data file
input_file_path = os.path.join(subdir_path, f"input_{i}.txt")
# Open the file for writing
with open(input_file_path, "w") as file:
random.seed(20000629 + i) # Seed to maintain reproducibility
# Write the random integers to the file
for _ in range(input_size):
file.write(str(random.randint(0, 5000)) + "\n")