random()

Either generates a random number or pulls a random value from an array.

This function is valid in v2.0.0 to v2.24.3. This function has been downloaded 79 times.

Parameters

{Array|number} arrOrMinOrMax
If an array, a random item from it will be returned. If this is a number and opt_max is either not given or boolean this will be seen as the maximum value. Otherwise this will be seen as the minimum value that can be returned.
{number|boolean=} opt_max Optional
If this is a number it will be interpreted as the maximum value. The maximum value will never be returned because a random number between the minimum value (inclusive) and the maximum value (exclusive) is always returned. If this is a boolean it will be used as opt_truncate and the maximum will come from arrOrMinOrMax thus setting 0 to arrOrMinOrMax.
{boolean=} opt_truncate Optional, Default:false
If true-ish and arrOrMinOrMax wasn't an array the returned value will be truncated.

Returns

{*}
If arrOrMinOrMax is an array a random value from the array will be returned, otherwise a random number in the given range will be returned.