How can I generate random integers between 0 and 9 (inclusive) in Python?
For example, 0, 1, 2, 3, 4
0
1
2
3
4
Try this through random.shuffle
random.shuffle
>>> import random >>> nums = range(10) >>> random.shuffle(nums) >>> nums [6, 3, 5, 4, 0, 1, 2, 9, 8, 7]