Seeding And Generating Random Integers
It is easy enough to generate a series of random numbers using the Random
module's int
function.
This will generate a random integer between 0 and 9.
You may notice that the randomness is the same each time you run your program. That is because you have fixed seed. To make sure you have a different seed each time your program runs, you can initialize the random number generator with something different at each run, such as the current time.
See a live example here.
Last updated