|
Category
General-Purpose Functions
Description
Returns a uniformly distributed random number
Syntax
Random(min {0}, max {0}, step {0})
Parameters
min {0} - the lowest value to possibly return
max {0} - the highest value to possibly return
step {0} - the smallest possible interval between return values
Notes
If called with no parameters, i.e. Random(), the return value is a decimal number between 0 and 1.
If called with one parameter, Random(n) returns a random integer between 0 and n inclusive. If called with two parameters, Random(a, b) returns a random integer between a and b inclusive. (In both cases the step defaults to 1, giving integer results; supply all three parameters for decimal results rounded to step.)
To obtain a random integer between 1 and 100, use Random(1,100,1).
To obtain a random limit price between 2% and 4% above yesterday's close, use Random(c*1.02, c*1.04, 0.01).
Example
RandVal: Random(1, 100, 1)
Random integer from 1 to 100. With no parameters, returns a decimal between 0 and 1.
|