UNPKG

738 BMarkdownView Raw
1# natural
2
3```js
4// usage
5chance.natural()
6chance.natural({ min: 1, max: 20 })
7```
8
9Return a natural number.
10
11_range: 0 to 9007199254740991_
12
13```js
14 chance.natural();
15 => 125019392395
16```
17
18Can optionally provide min and max.
19
20```js
21chance.natural({min: 1, max: 20});
22=> 14
23```
24
25Can optionally provide numbers you wish to exclude.
26
27```js
28chance.natural({min: 1, max: 5, exclude: [1, 3]});
29=> 2
30```
31
32These 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
371 <= random number <= 3
38
39// General case
40min <= random number <= max
41```
42
43
44[Natural Number on Wikipedia][natural]
45
46[natural]: https://en.wikipedia.org/wiki/Natural_number
47