# 10 rolls of 4 fair dice
dice(10,4, plot.it=TRUE)
# or
plot(dice(10,4))
# or
tmp <- dice(10,4)
plot(tmp)
# a loaded die
table(tmp <- dice(100,1,plot.it=TRUE, load=6:1 ) )
mean(tmp)
## redo De Mere's question
demere1 <- dice(10000,4)
demere2 <- dice(10000,24,sides=36)
mean(apply( demere1, 1, function(x) 6 %in% x ))
mean(apply( demere2, 1, function(x) 36 %in% x))
plot(demere1[1:10,])
## plot all possible combinations of 2 dice
plot.dice( expand.grid(1:6,1:6), layout=c(6,6) )
Run the code above in your browser using DataLab