Skip to main content

$$random

Returns a pseudo-random number that is greater than min and less than max

Usage​

"$$random([min],[max])"
note

Alternative form is available using

{
"$$random": [ /* min */, /* max */ ]
}

If min is used, the input argument is ignored and can be of any value

danger

Caution This function does not generate cryptographically secure values, and must not be used for cryptographic purposes, or purposes that require returned values to be unguessable.

Returns​

number (BigDecimal)

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
Input
minBigDecimal0The lowest value to return
maxBigDecimal1The upper bound (exclusive) for the returned value

Examples​

Input

Definition

Output

null
"$$random(1,5)"
2.853175231346362
null
"$$random(0,10000)"
7880.520931720825
null
"$$random(-1,0)"
-0.944145239228386
null
{
"$$random": [
1,
5
]
}
3.782006810876913