Random

The Random() generates a random number.

This function is NOT SQL compatible. For more information about SQL compatibility, see our documentation.

Syntax

Random(max_num)

Random(100) => 64

Random() => Invalid expression

Random(0) => Invalid expression # max_num should be greater than 0

Random(-10) => Invalid expression # max_num should be greater than 0

Random(min_num, max_num)

Random(10, 100) => 67

Random() => Invalid expression

Random(-10, 10) => a random value between -10 and 10 (accepted since version 4.2)

Random(20, 10) => Invalid expression # max_num should be greater than min_num

Parameters

Name
Type
Required
Description

max_num

numeric

☑️

the maximum value of the generated number.

min_num

numeric

the minimum value of the generated number.

Last updated

Was this helpful?