@dorianb/random-js
v0.0.7
Published
A random js library for a quite simple usage
Downloads
3
Readme
Documentation
Random
- Random
- .random() ⇒ number
- .randint(a, b) ⇒ number
- .choice(array) ⇒ any
- .bool() ⇒ boolean
- .sign() ⇒ number
- .percent(percentage) ⇒ boolean
Random.random() ⇒ number
Returns: number - Random number between 0 and 1
Random.randint(a, b) ⇒ number
Returns: number - A random integer in the interval [a, b]
| Param | Type | Description | | --- | --- | --- | | a | number | The lower band of the interval | | b | number | The upper band of the interval |
Random.choice(array) ⇒ any
Returns: any - The element randomly choosen
| Param | Type | Description | | --- | --- | --- | | array | Array | An array of elements |
Random.bool() ⇒ boolean
Returns: boolean - A random boolean
Random.sign() ⇒ number
Returns: number - Return +1 or -1 with a probability of 0.5
Random.percent(percentage) ⇒ boolean
| Param | Type | Description | | --- | --- | --- | | percentage | number | A percentage between 0 and 100 |
2020 © Dorian Beauchesne