I wanna create a lottery application. I have a 2d Array that has in the first column names and in the second number of lottery tickets.
Name NumberofLlotteryTickets
george 2
john 1
chris 3
I want to create another 1d array where each name appears as many times asthe number of tickets. So it is like this
Name
george
george
john
chris
chris
chris
I don't care if they appear consecutively. Just to appear as many times as the number of lottery tickets in order to make the random selection in the new array.
Do you have any idea on how to make the loops to create the new array? Is there any code for the random searh?
Also, the lottery will be repeated many times, so I want to delete the chosen name from the array I will search.
Thanks
Aucun commentaire:
Enregistrer un commentaire