|
Newsletters
|
|
|
|
|
WMLScript Reference
WMLScript Reference
WMLScript > Lang > random()
random() - The random Function
Usage: random(value)
Description: Returns an integer value with positive sign that is greater than or equal to 0 but less than or equal to the given value. The return value is chosen randomly or pseudo-randomly with approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy.
If the value is of type floating-point, Float.int() is first used to calculate the actual integer value.
Example:var a = 10;
var b = Lang.random(5.1)*a; // b = 0..50
var c = Lang.random("string"); // c = invalid
Bookmark this page
|
|