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


Card shuffling in c#

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


3/5/2018 10:30:45 AM

Abd Allah Abd Alkader

3 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


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)