random-hexadecimal
v1.0.3
Published
Return a random hexadecimal number.
Downloads
56
Maintainers
Readme
random-hexadecimal
Return a random hexadecimal number.
Install
$ npm install --save random-hexadecimal
Usage
For more use-cases see the tests
var randomHex = require('random-hexadecimal');
// API
// - randomHex([options]);
// options
// - min
// - max
By default it will return an hexadecimal number between 0
and 9007199254740992
:
randomHex();
// => '0xaf91'
Can optionally provide min
and max
:
randomHex({ max: 15 });
// => '0od'
randomHex({ min: 7, max: 15});
// => '0o7ab9'
Note: these min
and max
are inclusive, so they are included in the range.
Related
- random-integral - Return a random integer.
- random-natural - Return a random natural number.
- random-decimal - Return a random decimal.
- random-floating - Return a random floating point number.
- random-index - Return a random array-like index.
- random-binary - Return a random binary number.
- random-octal - Return a random octal number.
- random-unicode - Return a random unicode.
- random-bool - Return a random boolean (true/false).
- random-char - Return a random char.
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.