I want to create 10,000 random numbers withing the range of 1 to 100.
How can I do with python?
I can use for loop and with each for loop I can use random.sample() or random.random() function.
Is there any other way, without using any for loop I can generate it with built-in function ?
[rand.randrange(1,100) for _ in range(10000)]should do. But maybe you've got demands for no-repeats, etc... we don't knowrandom.sample(range(1,100), 10000)exactly? (for sampling without replacement orrandom.choices()with replacement)random.sample(range(1,100), 10000)you will get errorValueError: Sample larger than population or is negative