Procedural generators, for games and fake data.
- random
- .getRandom ⇒
any
- .getRange ⇒
Number
- .doProbability ⇒
Boolean
- .getRandom ⇒
############# random.getRandom ⇒ any
Kind: static constant of random
Returns: any
- Random element from input array.
Param | Type | Description |
---|---|---|
arr | [ 'Array' ].<any> |
Input array. |
############# random.getRange ⇒ Number
Kind: static constant of random
Returns: Number
- A random number between min
and max
(including).
Param | Type |
---|---|
min | Number |
max | Number |
############# random.doProbability ⇒ Boolean
Kind: static constant of random
Param | Type | Description |
---|---|---|
p | Number |
Probability as float between 0-1. |
- names
- .createName(config) ⇒
String
- .createName(config) ⇒
############# names.createName(config) ⇒ String
Creates a name in a given language.
"Languages" are approximations based on basic combination "rules" of selected vowels/consonants.
Kind: static method of names
Returns: String
- A clean, fully (potentially separated/accented) name.
Param | Type | Default | Description |
---|---|---|---|
config | Object |
||
[config.min] | Number |
1 |
Minimum number of syllables. |
[config.max] | Number |
3 |
Maximum number of syllables. |
[config.language] | LANGUAGES |
The language of the name. If not specified, a language will be picked at random. | |
[config.debug] | Boolean |
Return additional information. |
####################### createName.LANGUAGES : LANGUAGES
Kind: static property of createName
Language of generated name
Kind: global enum
Read only: true
Properties
- DEFAULT
String
- RANDOM
String
- NORDIC
String
- LATIN
String
- GOBLIN
String
- MOLE
String
- SPIDER
String
- BIBO
String