Skip to content
Reference > Methods

rand(range)

Definition

Number rand(Number range)

Description

Returns a random number between 0.0 (inclusive) and the supplied range (exculsive), if range is negative the returned value will also be <=0, note: this random is not secure.

Parameter Definition

Name Type Description
range Number

Examples

1
2
3
Integer r1 = rand(2); // r1 == 1
Double r2 = rand(12.2D); // r2 == 10.629729642880422
Integer r3 = rand(-19); // r3 == -3