mardi 20 décembre 2016

Dynamic number of random numbers

I've been using a Calc spreadsheet to keep track of my D&D character, and I'm looking to increase the automation in it all the time - in this case, I want it to roll my dice for me.

My character might do something like 2d6 points of damage (roll 2 6-sided dice, add together) or 12d8 points of damage (roll 12 8-sided dice, add together). If I know both of these numbers separately - the number of dice, and the sides of the dice, can I 'roll' this number?

I'm aware of the RandBetween function, which when given (1, N) as arguments will simulate rolling an N-sided die. But M x RandBetween(1, N) just multiplies the roll by M, rather than 'rolling' M times.

For portability reasons, I don't want to write a macro for this. Is there any kind of function or trick that will let me add an arbitrary number of random numbers?




Aucun commentaire:

Enregistrer un commentaire