random function

num random(
  1. num lower,
  2. num upper, [
  3. bool floating = false
])

Produces a random number between the inclusive lower and upper bounds.

Implementation

num random(num lower, num upper, [bool floating = false]) {
  if (floating) {
    return math.Random().nextDouble() * (upper - lower) + lower;
  }
  return math.Random().nextInt(upper.toInt() - lower.toInt()) + lower;
}