rand<T>(a?: T, b?: T): T
Get a random value between the given bound.
param
a- The lower bound. If not upper bound, this is the upper bound and the lower bound is 0.
param
b- The upper bound.
// a random number between 0 - 8
rand(8)
// a random point on screen
rand(vec2(width(), height()))
// a random color
rand(rgb(255, 255, 255))
// a random number between 50 - 100
rand(50, 100);
// a random point on screen with x between 20 - 100 and y between 20 - 100
rand(vec2(20), vec2(100));
// spawn something on the right side of the screen but with random y value within screen height
add([
pos(width(), rand(0, height())),
]);
since
v2000.0
group
Random