Namespace atropa.random
Version
20120909.
Provides random strings and numbers.
Defined in: <node_modules/atropa-random/src/atropa-random.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Provides random strings and numbers.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
atropa.random.getArrayKey(arr)
Get a random key from the given array.
|
<static> |
atropa.random.getArrayValue(arr)
Get a random value from the given array.
|
<static> |
atropa.random.getPropertyName(obj)
Get a random property name from the given object.
|
<static> |
atropa.random.integer(min, max)
Generates a random number between the specified min and max value.
|
<static> |
atropa.random.pullArrayElement(arr)
Remove a random element from the given array.
|
<static> |
atropa.random.pullProperty(obj)
Remove a random property from the given object.
|
<static> |
atropa.random.string(stringLength, characterClass)
Gives you a random string whose length and characters you specify.
|
Namespace Detail
atropa.random
Provides random strings and numbers.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Method Detail
<static>
{Number}
atropa.random.getArrayKey(arr)
Get a random key from the given array.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Array} arr
- The array to select a random key from. The keys of the array must be contiguous.
- Returns:
- {Number} A random integer between 0 and
arr.length
<static>
{Mixed}
atropa.random.getArrayValue(arr)
Get a random value from the given array.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Array} arr
- The array to select a random value from. The keys of the array must be contiguous.
- Returns:
- {Mixed} A random value from the given array.
<static>
{String}
atropa.random.getPropertyName(obj)
Get a random property name from the given object.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Object} obj
- The object to select a random property name from.
- Returns:
- {String} A random property name from the given object.
<static>
{Number}
atropa.random.integer(min, max)
Generates a random number between the specified min and max value.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Number} min
- The lowest number you want returned
- {Number} max
- The highest number you want returned
- Returns:
- {Number} A random number within the specified range.
<static>
{Mixed}
atropa.random.pullArrayElement(arr)
Remove a random element from the given array.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Array} arr
- The array to remove a random element from. The keys of the array must be contiguous.
- Returns:
- {Mixed} A random value from the given array.
<static>
{Mixed}
atropa.random.pullProperty(obj)
Remove a random property from the given object.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Object} obj
- The object to remove a random property from.
- Returns:
- {Mixed} A random value from the given object.
<static>
{String}
atropa.random.string(stringLength, characterClass)
Gives you a random string whose length and characters you specify.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
- Parameters:
- {Number} stringLength
- This is the length of the string.
- {String} characterClass
- Optional. May be one of: numeric, caps, lower, alpha, alphanumeric, punctuation, vowel, consonant This is the type of characters you want returned to you. Defaults to alphanumeric.
- Returns:
- {String} A random string of specified length and composition.