$reactions.random
This method returns a random integer number in the specified range.
Syntax
The method accepts one argument: an integer max
value:
$reactions.random(10);
The method returns a random integer from 0 to max
(not including max
).
Usage details
-
The method return values can be overridden in XML tests using the
<random>
tag. This ensures that the tests run stably.cautionYou cannot redefine the return values of theMath.random
built-in JavaScript method. Using it in JAICP scripts is not recommended. -
The return values can be overridden in the script by modifying the
$request.data.smartRandom
object. -
All return values are stored in
$response
and can be used to re-execute the script with the same results. -
The method ensures that the returned random numbers are not repeated more often once per every
max / 2
consecutive method calls.