UNPKG

585 BMarkdownView Raw
1# prime
2
3```js
4// usage
5chance.prime()
6chance.prime({ min: 1, max: 20 })
7```
8
9Return a prime number.
10
11_default range: 0 to 10000_
12
13```js
14 chance.prime();
15 => 929
16```
17
18Can optionally provide min and max.
19
20```js
21chance.prime({min: 1, max: 20});
22=> 13
23```
24
25
26These are inclusive, so they are included in the range. This means
27```chance.prime({min: 2, max: 5});``` would return either 2, 3, or 5 or:
28
29```js
30// Specific case
312 <= random number <= 5
32
33// General case
34min <= random number <= max
35```
36
37
38[Prime Number on Wikipedia][prime]
39
40[prime]: https://en.wikipedia.org/wiki/Prime_number
41