Skip to content

Commit

Permalink
Some helpful edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamas committed Jul 23, 2019
1 parent 6c60744 commit 87e5743
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lottery.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@

library(stats)

ticket <- array(0,10)
arr <- array(0,10)
for (i in 1:10){
# flip a bent coin with probability 0.1 of heads
ticket[i] <- if (runif(1) < 0.1) 1 else 0
arr[i] <- if (runif(1) < 0.1) 1 else 0
}

for (j in 1:100){
ticket <- array(0,10)
arr <- array(0,10)
for (i in 1:10){
# flip a bent coin with probability 0.1 of heads
ticket[i] <- if (runif(1) < 0.1) 1 else 0
arr[i] <- if (runif(1) < 0.1) 1 else 0
}
print(ticket)
}
print(arr)
}

0 comments on commit 87e5743

Please sign in to comment.