Wiki question: roll() function

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

Post Reply
bobthedog
Cave Troll
Posts: 85
Joined: Sun Aug 03, 2008 7:17 pm

Wiki question: roll() function

Post by bobthedog »

Hey there, I was just surfing around the wiki, looking for new functions do spice my macros up with, and found "dice" in the list. Clicking on it, I realized it's the "roll(times, sides)" that I've been using for ages, but the wiki description got me thinking:
You may also think of this function as a method of generating a random number between times and times*sides.
And also:
Roll five ten-sided dice, using variables.

Code: Select all

[h: DiceTimes = 5]
[h: DiceSides = 10]
[t: roll(DiceTimes, DiceSides)]
Returns a number than is between 5 and 50.
So, does roll() really work like that (the same as a rnd(start, end) function would work in most programming languages)? If it does, I'll have to work on some serious redefinition of macros, because rolling 5d10 is definitely not the same as rolling a "d46+4", as far as result distribution goes...

Can anyone with "programmer knowledge" clarify if roll() works as "expected" (2d6 yields a '7' six times more often than a '12')?

User avatar
zEal
Dragon
Posts: 944
Joined: Sun Mar 22, 2009 2:25 am

Re: Wiki question: roll() function

Post by zEal »

bobthedog wrote:So, does roll() really work like that (the same as a rnd(start, end) function would work in most programming languages)?
No, it doesn't. That little aside wasn't meant for people concerned with probability density. The dicelib 'rolls' each dice individually.

Post Reply

Return to “Documentation Requests/Discussion”