In Las Vegas the roulette wheel has a 0 and a 00 and then the numbers 1 to 36 marked on equal slots; the wheel is spun and a ball stops randomly in one slot. When a player bets 1 dollar on a number, he receives 36 dollars if the ball stops on this number, for a net gain of 35 dollars; otherwise, he loses his dollar bet. Find the expected value for his winnings.
\(E[] = (35*\frac{1}{38}) - \frac{37}{38} = -\frac{1}{19} = -0.05263\)
# Assign a variable p_seven as the probability of the ball landing on a 7
p_seven <- 1/38
# Assign a variable p_loser as the probability of the ball not landing on 7
p_loser <- 1 - p_seven
# Assign a varible s as the number of simulated wheel spins
s <- 100000L
# Set a seed to make sure the result matches the expected result
set.seed(1)
Profit <- replicate(s, {
P <- sample(c(35,-1), size = 100, replace =TRUE, prob = c(p_seven, p_loser))
sum(P)
})
mp <- mean(Profit)