Share this

Ask the Wizard #283

What is a Fisher-Yates shuffle?

Anonymous

The Fisher-Yates shuffle is a programming technique to shuffle an array in an unbiased and fast manner. Assume there are n items in the array. Set a counter equal to n.

  1. Choose a card at random from card number 1 to n-1.
  2. Swap that card with card number n.
  3. Subtract 1 from n.
  4. Repeat steps 1 to 3 until n=2.

Here is how it looks in C++. Note that this ignores modulo bias, for the sake of simplicity.

void fisher_yates(int deck[], int NumCards)
{
	int i,hold;
	unsigned int rn;
	for (i=NumCards-1; i>0; i--)
	{
		rn=genrand_int32()%(i+1);
		hold=deck[rn];
		deck[rn]=deck[i];
		deck[i]=hold;
	}
}


This question is discussed in my forum at Wizard of Vegas.

At the Lake Elsinore Hotel and Casino in California there is a blackjack side bet called the Red Flex. It pays according to the number of consecutive red cards in the dealer's hand, starting with the first card. The pay table is as follows:

  • Seven or more reds pays 200 to 1
  • Six reds pays 100 to 1
  • Five reds pays 50 to 1
  • Four reds pays 10 to 1
  • Three reds pays 5 to 1
  • Two reds pays 1 to 1

If the dealer busts, or isn't required to draw cards because all the players busted, the dealer will still draw cards as necessary to adjudicate the side bet.

What are the odds?

Anonymous

I show my analysis of the Red Flex in my blackjack appendix 8.

This question is discussed in my forum at Wizard of Vegas.

If the house does not allow double nor split, how does that affect house edge in blackjack?

Luke

Not allowing doubling increases the house edge by 1.48%. Not allowing splitting increases the house edge by 0.57%. Allowing neither increases the house edge by 1.91%.

In your last column, Eliot Jacobson asked about the expected value in pai gow poker if the player knew the first card would be an ace or joker. I assume this had something to do with being able to bet after seeing this card. Do you know more about why Eliot was asking?

odiousgambit

At the risk of making the advantage player community angry again, I'll just say there are some situations where the astute player can make a wager knowing what his first card will be.

The following table shows the probability of each card and the advantage, if greater than zero, when it is the first card. The conditional return is the expected win, given what the indicated first card is. The expected return is the product of the probability and conditional return columns.

Pai Gow Poker — First Card Queen or Better

Card Probability Conditional
Return
Expected
Return
Joker 0.018868 0.257773 0.004864
Ace 0.075472 0.136483 0.010301
King 0.075472 0.038914 0.002937
Queen 0.075472 0.000534 0.000040
All other 0.754717 0.000000 0.000000
Total 1.000000 0.018141

The above table shows that if the player plays only when the first card is a queen or higher his advantage per hand seen is 1.81%. The player will make a bet 24.52% of the time. The advantage per bet made is 7.40%.

Note how the advantage with a queen is 0.05% only. If we don't play those hands, then the table looks like this.

Pai Gow Poker — First Card King or Better

Card Probability Conditional
Return
Expected
Return
Joker 0.018868 0.257773 0.004864
Ace 0.075472 0.136483 0.010301
King 0.075472 0.038914 0.002937
All other 0.830189 0.000000 0.000000
Total 1.000000 0.018101

The above table shows that if the player plays only when the first card is a king or higher, then his advantage per hand seen is still 1.81%. The player will make a bet 16.98% of the time. The advantage per bet made is 10.66%.

Here is that table if the player plays aces or the joker only.

Pai Gow Poker — First Card Ace or Joker

Card Probability Conditional
Return
Expected
Return
Joker 0.018868 0.257773 0.004864
Ace 0.075472 0.136483 0.010301
All other 0.905660 0.000000 0.000000
Total 1.000000 0.015164

This shows that if the player plays only when the first card is an ace or joker, then his advantage per hand seen is still 1.52%. The player will make a bet 9.43% of the time. The advantage per bet made is 16.07%.

See discussion about this question in my forum at Wizard of Vegas.

There is an airplane 5 kilometers directly overhead. You shoot a heat-seeking missile it from the ground. The missile is always traveling directly towards the plane. The plane can travel 10 kilometers per minute, travels in a straight line and maintains the same altitude. The missile can travel 11 kilometers per minute. How long will it take the missile to strike the plane?

Anonymous

To see an integral you may find useful, select the black region below.

The integral of (1+x^2)^0.5 dx = ln(x + (1+x^2)^0.5) + constant of integration.

To see the answer, select the black region below.

55/21 minutes = 2.6195 minutes = 157.1429 seconds.