Returns a random number . Random numbers are not truly random, since they use deterministic algorithms - they are more correctly referred to as pseudo-random. By specifying an initial value, or seed, a repeatable sequence of random numbers can be generated.
random ( Optional seed As Integer = 0) As Any
Argument | Type | Description |
---|---|---|
seed | Integer | Optional; seed value used to generate a repeatable series of pseudo-random numbers. The default is 0, which (generally) creates a pseudo-random series. |
Intent >random()
--> 0.19330423902097
Your result will vary Rule random1 As Number
random(seed := 1)
Return roundToNearest(random(), 0.001)
End Rule
Intent >random1
--> 0.564
Evaluating the rule random1 will consistently return 0.564 Rule random2 As Number
random(seed := 2731774)
Dim result As List = {}
Dim i As Integer
For i = 1 to 9
result = result + {roundToNearest(random(), 0.001)}
Next i
Return result
End Rule
Intent >random2
--> {0.99, 0.29, 0.394, 0.7, 0.546, 0.352, 0.49, 0.154, 0.194}
The rule random2 will consistently return this list of values.