Namespace util.random
Module to emulate some of Python's random library.
Defined in: <js/util/random.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
util.random.gauss(mu, sigma)
Returns a random number from an approximately Gaussian distribution.
|
<static> |
util.random.randInt(a, b)
Choose a random integer from [a, b]
|
<static> |
util.random.shuffle(list)
Shuffles a list in place, returning nothing.
|
<static> |
util.random.uniform(a, b)
Get a random number selected from a uniform distribution.
|
Method Detail
<static>
{number}
util.random.gauss(mu, sigma)
Returns a random number from an approximately Gaussian distribution.
See: http://www.protonfish.com/random.shtml
- Parameters:
- {number} mu
- Mean (default: 0).
- {number} sigma
- Standard deviation (default: 1).
- Returns:
- {number} Random number from Gaussian distribution.
<static>
{number}
util.random.randInt(a, b)
Choose a random integer from [a, b]
- Parameters:
- {number} a
- Minimum integer that can be returned.
- {number} b
- Maximum integer that can be returned.
- Returns:
- {number} Random integer between a and b.
<static>
util.random.shuffle(list)
Shuffles a list in place, returning nothing.
- Parameters:
- {array} list
- List to be shuffled in place.
<static>
{number}
util.random.uniform(a, b)
Get a random number selected from a uniform distribution.
- Parameters:
- {number} a
- Minimum number that can be returned.
- {number} b
- Maximum number that can be returned.
- Returns:
- {number} Random number from uniform distribution.