Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

//==========Rand Int==========
// Input:     min, max, pm
// Output:     random integer between min and max
//                pm denotes plus or minus
function RandomInt(min, max, pm) {
    min = Math.ceil(min);
    max = Math.floor(max);
    pm = pm || 0;
    var plusMinus = Math.random() < 0.5 ? -1 : 1;
    var random = Math.floor(Math.random() * (max - min + 1)) + min;
  return pm != 0 ? random * plusMinus : random;
}
  • No labels