Shuffling Cards (Randomizing Arrays) the RIGHT Way!
A while back, I was writing a blackjack simulator where I needed to model shuffling a deck of cards (randomizing the elements of an array). This problem seemed simple; so simple that I made a big mistake. The code I was writing was in Java, but the examples here are in C.
The simple, logical approach to randomizing arrays is to loop through the array, and swap each element with some random element. This might look something like below.
1 Comment »
Comment by lucydance
February 23, 2008 @ 4:25 pm #
I have been in Network Marketing for about 15 years. I have NEVER seen such a total opportunity where almost everyone who takes a look wants to join. People just see the magic in this program
check it out by going to..
Carbon Copy Pro Team
RSS feed for comments on this post. TrackBack URI
Leave a comment