Card shuffling in c# | Sololearn: Learn to code for FREE!

+2

Card shuffling in c#

How can i do shuffle with the card game? I have 52 cards

c#

3/5/2018 10:30:45 AM

Abd Allah Abd Alkader

3 Answers

New Answer

+16

@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

+6

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.

+1

its possible to use a random number generator and loop through your array changing the position of values (or objects or card's)