File: prime.md

package info (click to toggle)
node-chance 2.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,612 kB
  • sloc: javascript: 16,572; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# prime

```js
// usage
chance.prime()
chance.prime({ min: 1, max: 20 })
```

Return a prime number.

_default range: 0 to 10000_

```js
  chance.prime();
  => 929
```

Can optionally provide min and max.

```js
chance.prime({min: 1, max: 20});
=> 13
```


These are inclusive, so they are included in the range. This means
```chance.prime({min: 2, max: 5});``` would return either 2, 3, or 5 or:

```js
// Specific case
2 <= random number <= 5

// General case
min <= random number <= max
```


[Prime Number on Wikipedia][prime]

[prime]: https://en.wikipedia.org/wiki/Prime_number