Multiple choice technology programming languages

How do you generate random numbers within a given limit with actionscript?

  1. Math.round(Math.random() * (high - low)) + low

  2. Math.round(Math.random())

  3. Math.round(Math.random())+ low

  4. None of the baove

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Math.random() returns a value in the range [0, 1). Multiplying it by the range size (high - low), rounding the result using Math.round(), and shifting it by adding low correctly generates a random integer in the closed interval [low, high]. Other choices fail to scale or shift the output correctly.