Dice game probabilities: Difference between revisions

m
→‎{{header|R}}: Syntax highlighting.
(→‎{{header|Wren}}: Now uses new core library method.)
m (→‎{{header|R}}: Syntax highlighting.)
Line 1,992:
=={{header|R}}==
Solving these sorts of problems by simulation is trivial in R.
<lang rrsplus>probability <- function(facesCount1, diceCount1, facesCount2, diceCount2)
{
mean(replicate(10^6, sum(sample(facesCount1, diceCount1, replace = TRUE)) > sum(sample(facesCount2, diceCount2, replace = TRUE))))
331

edits