10001110100110101

Sun Mon Tue Wed Thu Fri Sat
6 7 8* 9 10 11 12
13 14* 15 16* 17 18 19
20 [21]* 22 23 24 25 26
27 28 29 30 31* 1 2
3 4* 5 6 7 8 9

[1:12 PM EDT - Mental Exercise: Random card shuffler.]

GY told me about this interesting puzzle that took me a long time to figure out some sort of incomplete solution to.

Basically, here is the scenario:

Someone wrote a program to shuffle a deck of cards by taking the first card, and randomly inserting that card back into the deck. This also includes itself! It would then go to the next card, and then randomly insert that card into the deck. This will continue down to the end of the deck.

Will this algorithm properly randomize the deck? Please explain why or why not.

Does anyone have a quick answer?

Whoops! I explained it incorrectly! It is not a simple insert, but a swap!

Someone wrote a program to shuffle a deck of cards by taking the first card, and randomly SWAPPING that card with any card in the deck. This also includes itself! It would then go to the next card which will then be randomly swapped with any card in the deck. This will continue down to the end of the deck.

Will this algorithm properly randomize the deck? Please explain why or why not.

Forgiviness please!

[8 Comments]

Monday, March 30, 2015 @ 21:43:33 EDT

« List of pages on this site:

« List of recent entries:

« List of recent comments:

« List of recent links:

« List of random quotes:

"I wonder what it means when your grandson is more crotchety than you are."

Aaron McGruder (From The Quotations Page.)