Skip to content

Commit

Permalink
Better names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelena4 committed Sep 10, 2019
1 parent 87e5743 commit 3ad66f0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lottery.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@

library(stats)

arr <- array(0,10)
for (i in 1:10){
arr[i] <- if (runif(1) < 0.1) 1 else 0
n_flips=30
outcomes <- array(0,n_flips)
prob_heads=0.1
for (i in 1:n_flips){
outcomes[i] <- if (runif(1) < prob_heads) 1
else 0
}

for (j in 1:100){
arr <- array(0,10)
for (i in 1:10){
arr[i] <- if (runif(1) < 0.1) 1 else 0
n_trials=100
for (j in 1:n_trials){
outcomes <- array(0,n_flips)
for (i in 1:n_flips){
outcomes[i] <- if (runif(1) < prob_heads) 1
else 0
}
print(arr)
print(outcomes)
}

0 comments on commit 3ad66f0

Please sign in to comment.