26. Random Number Generation Functions
Use the functions below to generate random integer values.
randomInt
Returns a pseudorandom, uniformly distributed int value from a random number generator initiated at workflow start.
The values returned will be pseudorandomly generated and returned. All 2^31 possible int values are produced with (approximately) equal probability.
This function uses the standard Java Random class. Refer to JDK documentation for exact details on the algorithm used for generating pseudorandom values.
int randomInt(int bound)
Parameter | Description |
---|---|
| The upper bound (exclusive). Must be positive. |
Returns | A random integer in the range 0 to bound-1 |
randomLong
Returns a pseudorandom, uniformly distributed long value from a random number generator initiated at workflow start.
The values returned will be pseudorandomly generated and returned. The algorithm uses a seed with only 48 bits, which means that not all possible long values will be returned.
This function uses the standard Java Random class. Refer to JDK documentation for exact details on the algorithm used for generating pseudorandom values.
long randomLong()
Parameter | Description |
---|---|
Returns | A random long |