@chancejs/natural
v1.0.0
Published
Generate a random natural number with Chance.js.
Downloads
2
Readme
natural
// usage
chance.natural()
chance.natural({ min: 1, max: 20 })
Return a natural number.
range: 0 to 9007199254740991
chance.natural();
=> 125019392395
Can optionally provide min and max.
chance.natural({min: 1, max: 20});
=> 14
Can optionally provide numbers you wish to exclude.
chance.natural({min: 1, max: 5, exclude: [1, 3]});
=> 2
These are inclusive, so they are included in the range. This means
chance.natural({min: 1, max: 3});
would return either 1, 2, or 3 or:
// Specific case
1 <= random number <= 3
// General case
min <= random number <= max