randomfloat
Function
Number variable operator: random floating point number generator. This sets a number variable to a random floating point value between 0 and the value specified after the operator. An integer, floating point number or an existing number variable must be used as the argument.
Syntax
|
<variable_name> randomfloat <integer>|<floating_point>|<number_variable>
|
Notes & examples
|
The floating point number assigned to the variable will have a precision of 2 digits after the decimal period. So for example, if you use the command:
local.bob randomfloat 1
The value of local.bob could be anything from 0.00 to 1.00. If you use a negative value as the command argument, the principle remains the same. So by using the following command:
local.bob randomfloat -1
The value of local.bob could be anything from -1.00 to 0.00
If the <variable_name> doesn't exist, this command will automatically create it and assign a value to it. If the <variable_name> already exists, the operator will simply change it's current value to the new value specified in the command argument.
Note: Do not use a text string or a string variable as the argument for this command.
|
|