1 | # natural
|
2 |
|
3 | ```js
|
4 | // usage
|
5 | chance.natural()
|
6 | chance.natural({ min: 1, max: 20 })
|
7 | ```
|
8 |
|
9 | Return a natural number.
|
10 |
|
11 | _range: 0 to 9007199254740991_
|
12 |
|
13 | ```js
|
14 | chance.natural();
|
15 | => 125019392395
|
16 | ```
|
17 |
|
18 | Can optionally provide min and max.
|
19 |
|
20 | ```js
|
21 | chance.natural({min: 1, max: 20});
|
22 | => 14
|
23 | ```
|
24 |
|
25 | Can optionally provide numbers you wish to exclude.
|
26 |
|
27 | ```js
|
28 | chance.natural({min: 1, max: 5, exclude: [1, 3]});
|
29 | => 2
|
30 | ```
|
31 |
|
32 | These are inclusive, so they are included in the range. This means
|
33 | ```chance.natural({min: 1, max: 3});``` would return either 1, 2, or 3 or:
|
34 |
|
35 | ```js
|
36 | // Specific case
|
37 | 1 <= random number <= 3
|
38 |
|
39 | // General case
|
40 | min <= random number <= max
|
41 | ```
|
42 |
|
43 |
|
44 | [Natural Number on Wikipedia][natural]
|
45 |
|
46 | [natural]: https://en.wikipedia.org/wiki/Natural_number
|
47 |
|