Math.ceil(math.random( [insert die size+1 here] ) works for a single die. You always want to add that last 1 in because math.random(x) produces a number between 0 and (x-1), since 0 counts as a number. The function math.ceil() prevents rolling a "0" by boosting the random number to its next-highest integer value. It's not -perfect-, but it's close enough that nobody will notice.
If you're doing multiple dice, take the minimum roll minus one, add it as an integer, and randomize the remainder plus one. For example, 3d12 would be random(35)+2. No matter the pool of dice, no matter if you're using multiple "die sizes", this is the most efficient manner to perform the task. 2d6 + 2d10?
(Math.ceil(math.random(30)+3)
You could also split things up to make it feel more "real". The totals wouldn't change, but doing things thisaway instead would allow for separate RNG per pool. 2d6 + 2d10, for example:
c = (math.ceil(math.random(12)+1))+(math.ceil(math.random(20)+1))
Or, even better, the "fancy" way, "rolling" each die separately. This is -probably- the most useful way to manage a dice-based system, as typing all that mess over and over and over and over gets tedious. Pre-define your variables in a script - there are plenty of ways to accomplish this.
var diceroll2 = (math.ceil(math.random(3);
var diceroll4 = (math.ceil(math.random(5);
var diceroll6 = (math.ceil(math.random(7);
var diceroll8 = (math.ceil(math.random(9);
var diceroll10 = (math.ceil(math.random(11);
var diceroll12 = (math.ceil(math.random(13);
var diceroll20 = (math.ceil(math.random(21);
var diceroll100 = (math.ceil(math.random(101);
var dicepool = 0;
And then for your damage formulas, just set it up somewhat like so, remembering to zero out your "dice pool" at the end (using the same 2d6+2d10 example):
dicepool = 2;
for (var i = 0; i < dicepool; i++) {
c+= diceroll6
};
dicepool = 2;
for (var i = 0; i < dicepool; i++) {
c+= diceroll10
};
dicepool = 0;
... If I'm off base anywhere, someone, anyone, please jump in and rectify my error. I'm half asleep and a moderate novice at js myself.
[edit: changed some ":" to ";" in a few cases of somnolent typographic error]