i would like to know how i can make the system pick a random number between 1 to 5 and store it in a global variable?
Develop games in your browser. Powerful, performant & highly capable.
set the variable to
and it will work fine
Generate a random float from 0 to x, not including x. E.g. random(4) can generate 0, 2.5, 3.29293, but not 4. Use floor(random(4)) to generate just the whole numbers 0, 1, 2, 3.
Generate a random float between a and b, including a but not including b.
ceil(x) Round up x e.g. ceil(5.1) = 6
floor(x) Round down x e.g. floor(5.9) = 5
round(x) Round x to the nearest whole number e.g. round(5.6) = 6