Lotto random number generator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Lotto random number generator

I'm writing a program to generate random lotto numbers I adapted a bit of code from Memphis Reigns ( thanks Memphis) I'm a bit stuck when it comes to checking if the random number has already been chosen Should I put a conditional loop in? I know it's been done before but thought it would be interesting

27th Apr 2018, 9:32 PM
Joe Mabbort
Joe Mabbort - avatar
3 Answers
+ 4
You can set all not-generated numbers in a list then you generate a number i from 0 and n where n is current length of list for obtain the generated number list[i] ... After this, you must remove the number from the list and repeat
27th Apr 2018, 9:49 PM
KrOW
KrOW - avatar
+ 2
Thanks for that Xan
28th Apr 2018, 5:07 AM
Joe Mabbort
Joe Mabbort - avatar