Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n <- 1e7
- # Max of 2d20
- r1 <- sample(1:20,n,T)
- r2 <- sample(1:20,n,T)
- max.r1r2 <- apply(as.matrix(cbind(r1,r2)),1,max)
- # Reroll 1d20 if < N
- N <- 10
- r3 <- sample(1:20,n,T)
- r3[r3 < N] <- sample(1:20,length(which(r3 < N)),T)
- # compare using hist() or similar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement