My task is to generate different files and each of them has a specific size. This size includes random numbers that are written in the file. As an example, if the size is 100, it means the program needs to write 100 random numbers and generate a file and add them to that file. My problem is that by running this code I will get for example 100 numbers but they are all the same and non of them is different. Can you help me how to fix it?
import random
import time
def fillFile(fileSize, fileName):
for i in range(fileSize):
values = random.randint(0, fileSize + 1000)
file = open(fileName + ".txt", "w")
for i in range(fileSize):
file.write(f"{i} {values}\n")
fileSizes = [1000, 5000, 10000, 25000, 50000, 100000, 200000]
def readFile(fileName):
files= open(str(fileName) + ".txt", "r")
values = []
for line in files:
values.append(line.split())
return values