jaytea commented on a Page, DnD Roller  -  Dec 06, 2010

ah yes, the ol' "sum of N identically distributed uniform random variables" :P i've wrestled with this in the past, tried to find a generalized closed form approximation for the probability distribution function of XdY for any X and Y. needless to say, i concluded that resorting to summing $r(1, Y) over X iterations was by far the most sane approach to the problem! (see the Irwin-Hall Distribution)

and it's great to see you've avoided the use of regular expressions to locate XdY, it certainly exposes one to clever and more realistic coding techniques ;P realism aside, an example of an alternative to a while loop that can be used once you've identified X and Y is the following:

//tokenize 100 2d20 | echo -a $calc( [ $str(+$r(1, $2), $1) ] )

Champagne, you're well aware that enjoyment of any description is strictly forbidden in #mSL!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.