Answers for "python random sample without repeats"

2

generate a list of random non repeated numbers python

#This will return a list of 50 numbers selected from the range 0 to 999, without duplicates.
import random
random.sample(range(1000), 50)
Posted by: Guest on November-27-2020
0

python random number generator no duplicates

python -c "import random; print(sorted(set([random.randint(6,49) for i in range(7)]))[:6])"
Posted by: Guest on December-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language