Namespace R.lang.Math2
A static class which provides methods for generating random integers
and floats between 0 and 1. The class also provides a way to seed the
random number generator for repeatable results.
Defined in: lang.math2.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
R.lang.Math2.MAX_INT
Largest integer (4294967295)
|
Method Attributes | Method Name and Description |
---|---|
<static> |
R.lang.Math2.parseBin(bin)
Parse a binary string into a number.
|
<static> |
R.lang.Math2.random()
Returns a pseudo-random number between 0 (inclusive) and 1 (exclusive)
|
<static> |
R.lang.Math2.randomInt()
Returns a random integer between 0 and 4,294,967,296.
|
<static> |
R.lang.Math2.randomRange(low, high, whole)
Return a random value within the low to height range,
optionally as an integer value only.
|
<static> |
R.lang.Math2.seed(seed)
Seed the random number generator with a known number.
|
<static> |
R.lang.Math2.toBinary(num)
Converts a number to a binary string.
|
<static> |
R.lang.Math2.toHex(num)
Converts a number to a hexidecimal string, prefixed by "0x".
|
Field Detail
<static>
R.lang.Math2.MAX_INT
Largest integer (4294967295)
Method Detail
<static>
{Number}
R.lang.Math2.parseBin(bin)
Parse a binary string into a number.
- Parameters:
- bin
- {String} Binary string to parse
- Returns:
- {Number}
<static>
{Number}
R.lang.Math2.random()
Returns a pseudo-random number between 0 (inclusive) and 1 (exclusive)
- Returns:
- {Number} A number between 0 and 1
<static>
{Number}
R.lang.Math2.randomInt()
Returns a random integer between 0 and 4,294,967,296.
- Returns:
- {Number} An integer between 0 and 2^32
<static>
{Number}
R.lang.Math2.randomRange(low, high, whole)
Return a random value within the low to height range,
optionally as an integer value only.
- Parameters:
- low
- {Number} The low part of the range
- high
- {Number} The high part of the range
- whole Optional
- {Boolean} Return whole values only
- Returns:
- {Number}
<static>
R.lang.Math2.seed(seed)
Seed the random number generator with a known number. This
ensures that random numbers occur in a known sequence.
- Parameters:
- seed
- {Number} An integer to seed the number generator with
<static>
{String}
R.lang.Math2.toBinary(num)
Converts a number to a binary string.
- Parameters:
- num
- {Number} The number to convert
- Returns:
- {String}
<static>
{String}
R.lang.Math2.toHex(num)
Converts a number to a hexidecimal string, prefixed by "0x".
- Parameters:
- num
- {Number} The number to convert
- Returns:
- {String}