How can i do shuffle with the card game? I have 52 cards
3/5/2018 10:30:45 AM
Abd Allah Abd Alkader3 Answers
New Answer@Faryaad , there is very high possibility that same number will come again which that will result in cards getting repeated get idea from my program , 20 cards taken out randomly without repeating https://code.sololearn.com/cLjUoS6I0JR9/?ref=app
1. Generate random number between 1 and 52. 2. Set a boolean flag (used[num]) to true. 3. While num is used, add 1 to num. 4. Repeat step 1, 51 more times. If need be, I can generate some code to show you how it works.
its possible to use a random number generator and loop through your array changing the position of values (or objects or card's)
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message