What to add in rand() function so that each random no will pop up the screen only once during execution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What to add in rand() function so that each random no will pop up the screen only once during execution

for creating bingo

16th Apr 2017, 9:43 AM
Tanmay Shimpi
Tanmay Shimpi - avatar
2 Answers
+ 1
I would recommend a hashmap for this, since searching is a lot faster in one.
16th Apr 2017, 12:50 PM
Norbivar
Norbivar - avatar
0
Some form of an array, with a check if the new number is already in the array, with a loop to continue picking numbers until you have selected a new number and added it to the array
16th Apr 2017, 12:00 PM
LordHill
LordHill - avatar