Generate Random Integers in Range in Python | Delft Stack
https://www.delftstack.com/howto/python/random-integers-between-range...To generate a list of random numbers with this function, we can use the list comprehension method with the for loop as shown below: Python. python Copy. import random x = [random.randint(0, 9) for p in range(0, 10)] print(x) Output: text Copy. [1, 6, 6, 5, 8, 8, 5, 5, 8, 4] Note that this method only accepts integer values.