Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > General Gambling > Probability

Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2005, 12:03 AM
EnderFFX EnderFFX is offline
Junior Member
 
Join Date: Feb 2004
Posts: 3
Default If I wanted to shuffle 8 decks of cards

And I decided to this shuffle by picking two random cards from the 8 decks ans swapping their position, how many iterations would I need to have a properly shuffled 8 decks of cards?

Is this a good method of shuffling for statistial analysis?
Reply With Quote
  #2  
Old 10-26-2005, 11:51 AM
alThor alThor is offline
Junior Member
 
Join Date: Mar 2004
Posts: 6
Default Re: If I wanted to shuffle 8 decks of cards

[ QUOTE ]
And I decided to this shuffle by picking two random cards from the 8 decks ans swapping their position, how many iterations would I need to have a properly shuffled 8 decks of cards?

Is this a good method of shuffling for statistial analysis?

[/ QUOTE ]

Do it this way. Randomly swap the card in slot 1 with the card in a randomly chosen slot (possibly itself!). Then swap slot 2's card with a card randomly chosen from slot 2...n. Swap 3's into 3...n, etc. This takes n-1 iterations, and is guaranteed random (up to the limits of your rng).

alThor
Reply With Quote
  #3  
Old 10-26-2005, 02:05 PM
Guest
 
Posts: n/a
Default Re: If I wanted to shuffle 8 decks of cards

In all the programs I've written a shuffle function I've just taken each card, 0..51 and swapped it with a random card. I haven't noticed any problems with this method starting with an in order deck playing Blackjack.
Reply With Quote
  #4  
Old 10-26-2005, 03:12 PM
TomCollins TomCollins is offline
Senior Member
 
Join Date: Jul 2003
Location: Austin, TX
Posts: 172
Default Re: If I wanted to shuffle 8 decks of cards

This algorithm is flawed and will result in a biased deck.

Think about a 3 card deck. There are 27 possibilites that are equally likely. There are only 6 distinct decks. How can you divide the 27 possibilities into 6 decks? Obviously one distribution happens more than another.
Reply With Quote
  #5  
Old 10-26-2005, 03:52 PM
TomCollins TomCollins is offline
Senior Member
 
Join Date: Jul 2003
Location: Austin, TX
Posts: 172
Default Re: If I wanted to shuffle 8 decks of cards

To clarify, the following distribution happens:

ABC -4
ACB -5
BAC -5
BCA -5
CAB -4
CBA -4

So we only see C as the first card 8/27 times, and we see B 10/27 times. Definitely not fair.
Reply With Quote
  #6  
Old 10-26-2005, 04:20 PM
Guest
 
Posts: n/a
Default Re: If I wanted to shuffle 8 decks of cards

Aye, I had just run a simulation after realizing you were right through ten million hands:

ABC - 1,482,563
ACB - 1,850,627
BAC - 1,851,344
BCA - 1,851,525
CBA - 1,481,467
CAB - 1,482,474
Reply With Quote
  #7  
Old 10-26-2005, 04:33 PM
pzhon pzhon is offline
Member
 
Join Date: Mar 2004
Posts: 66
Default Re: If I wanted to shuffle 8 decks of cards

[ QUOTE ]
And I decided to this shuffle by picking two random cards from the 8 decks ans swapping their position, how many iterations would I need to have a properly shuffled 8 decks of cards?

[/ QUOTE ]
My guess is that this behaves a lot like the top-in shuffle, which in some sense takes about n log n iterations to randomize a deck with n cards.

However, the best I could find was that about 2 n^2 iterations suffice to randomize the deck. See problems 6 and 7 on this homework assignment.

More precisely, there is a random (but dependent) stopping time at which the deck is uniformly shuffled so that the expected stopping time is 2n^2. The probability that the stopping time is greater than 2n^2+k decays exponentially in k.

[ QUOTE ]

Is this a good method of shuffling for statistial analysis?

[/ QUOTE ]
No. There are fast, effective algorithms. This is not one of them.
Reply With Quote
  #8  
Old 10-26-2005, 04:50 PM
pzhon pzhon is offline
Member
 
Join Date: Mar 2004
Posts: 66
Default Re: If I wanted to shuffle 8 decks of cards

[ QUOTE ]

My guess is that this behaves a lot like the top-in shuffle, which in some sense takes about n log n iterations to randomize a deck with n cards.

However, the best I could find was that about 2 n^2 iterations suffice to randomize the deck.

[/ QUOTE ]
There is a claim that about n log n random transpositions suffice here. See the comments by Speaker III.
Reply With Quote
  #9  
Old 10-26-2005, 07:03 PM
AaronBrown AaronBrown is offline
Senior Member
 
Join Date: May 2005
Location: New York
Posts: 505
Default Re: If I wanted to shuffle 8 decks of cards

One simple principle that is too-often overlooked is that it helps to start with a mixed up deck. Minor imperfections in your shuffling algorithm make a lot less difference if you start with a randomized deck than if you start with Ace of Spades 1, Ace of Hearts 2 and so on.

The theoretical calculations are typically based on whether a perfectly-informed mathematician could find any +EV bet on any card combination. In most games, it doesn't make much difference to know that the probability of 5 of clubs being in position 8 from the top of the deck is slightly more or less than 1 in 52. Moreover, it takes an astronomical number of hands for someone to be able to notice this. But it can make a lot of difference to know, and you can notice pretty fast, if, say, two Aces in a row occur with probability slightly different than 1/17.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.