I am pretty happy to say I think I have my first coin flip problem running. I am counting how many times it takes to get all heads or all tails in a trial of 7 flips. In theory it should take around 64 times to get either all heads or all tails.
coin.counter = 0 ## initialize global counting variable
heads.tails = 0 ## initialize global variable
while(heads.tails != 7|0){ ## do while not 7 or 0
heads.tails = rbinom(1,7,.5) ## 1 trial, 7 flips
if(heads.tails != 7|0) ### NOT equal to 0 or 7
coin.counter = coin.counter + 1
else
break
}
Unfortunately, I think that I am only getting one value because as I continue to run this script I keep getting coin.counter values in the mid 100s.
What can I try to fix this?