countsuccess: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "source>" to "syntaxhighlight>") |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 5: | Line 5: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
countsuccess(times, sides, target) | countsuccess(times, sides, target) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
success(times, sides, target) | success(times, sides, target) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 18: | Line 18: | ||
|examples= | |examples= | ||
Roll twenty ten-sided dice, and return the number that are above five. | Roll twenty ten-sided dice, and return the number that are above five. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t: countsuccess(20, 10, 5)] | [t: countsuccess(20, 10, 5)] | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 24: | Line 24: | ||
Roll twelve six-sided dice, and return the number that are above three, using variables. | Roll twelve six-sided dice, and return the number that are above three, using variables. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: DiceTimes = 12] | [h: DiceTimes = 12] | ||
[h: DiceSides = 6] | [h: DiceSides = 6] |
Latest revision as of 21:18, 14 March 2023
countsuccess() Function
Generates random numbers to emulate dice rolls; returns the count of dice rolls that are above a certain target number.
Usage
countsuccess(times, sides, target)
success(times, sides, target)
Parameters
times
- The number of times to roll the dice.sides
- The number of sides the dice possess.target
- The number that a dice needs to be equal to or higher to be considered a success.
Examples
Roll twenty ten-sided dice, and return the number that are above five.
Returns a number than is between
[t: countsuccess(20, 10, 5)]
Returns a number that is between 0
and 20
, which is the number of dice that rolled higher than 5
.
Roll twelve six-sided dice, and return the number that are above three, using variables.
[h: DiceTimes = 12]
[h: DiceSides = 6]
[h: DiceSuccess = 3]
[t: countsuccess(DiceTimes, DiceSides, DiceSuccess)]
0
and 12
, which is the number of dice that rolled higher than 3
.See Also
For another method of rolling dice, see Dice Expressions.