Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. set.seed(0)
  2. n = 10^6 #no. simulations
  3. sam = replicate(n, sample(0:1, 7, replace = T))
  4. L = sam[,sam[7,]==0]
  5. (freq_ending_in_T_and_three_heads = sum(colSums(L)==3)/n)
  6. [1] 0.156561
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement