/
random
random
The random library provides a few convenience functions to generate random content
word
Returns a random word using node random-words package. Note that random-words parameters are not supported in KRL.
str = random:word()
uuid
Generates a UUID using node cuid package.
str = random:uuid()
integer
Returns a random integer between lower
and upper
(inclusive) using Lodash's random. The range bounds can be equal or in any order.
n = random:integer(upper = 2, lower = 0) a = random:integer(5) //returns random integer where 0 <= a <= 5
Because upper
is the first argument, you can call this function with a single argument to get a random integer between 0
and that number.
number
Returns a random number (float) between lower
and upper
(inclusive) using Lodash's random. The range bounds can be equal or in any order.
n = random:number(lower = 0, upper = 1)
Related content
Map Operators
Map Operators
Read with this
Array Operators
Array Operators
Read with this
Looping in Rules
Looping in Rules
Read with this
String Operators
String Operators
Read with this
Universal Operators
Universal Operators
Read with this
Copyright Picolabs | Licensed under Creative Commons.