How to get unique numbers using randomint python?
Posted
by
user2519572
on Stack Overflow
See other posts from Stack Overflow
or by user2519572
Published on 2013-06-25T10:17:55Z
Indexed on
2013/06/25
10:21 UTC
Read the original article
Hit count: 274
I am creating a 'Euromillions Lottery generator' just for fun and I keep getting the same numbers printing out. How can I make it so that I get random numbers and never get the same number popping up:
from random import randint
numbers = randint(1,50)
stars = randint(1,11)
print "Your lucky numbers are: ", numbers, numbers, numbers, numbers, numbers
print "Your lucky stars are: " , stars, stars
The output is just:
>>> Your lucky numbers are: 41 41 41 41 41
>>> Your lucky stars are: 8 8
>>> Good bye!
How can I fix this?
Regards
© Stack Overflow or respective owner