random

To return a random number

The function generates a random number between 0 (inclusive) and 1 (exclusive). Therefore the return value is equal to or greater than 0 and less than 1.

With the help of this function, you can generate passwords, check digits or ID numbers. You also can realize non-linear test runs or quizzes.

Syntax

random()

Return

number

Examples

random() 

Result (for example): 0.0817465303933449

floor(random() * 10)

Result (for example): 4

round(random() * 100, 2)

Result (for example): 7.12

Last updated