Random-Number-String
A simple helper library to provide cryptographically secure random numbers and strings. Why? Because I couldn't find a package for both.
Installing:
npm install random-number-string
Using:
const charSet randFlt randInt randStr = ; console;console;console;console;
charSet
Includes some commonly used character sets like the alpha-numerics. Use it like this:
//These ones are properties:console;console;console;console;console;console;console;console; //These ones are methods that return the sets as strings:console;console;console;console;console;
randFlt(min, max, res)
Returns a random float in the range [min, max).
Default range is [0, 1). res
is set for you.
randInt(min, max, res)
Returns a random integer in the range [min, max).
Default range is [0, 100). res
is set for you.
randStr(len, chars)
Returns a random string of length len
from a character set chars
.
Default returns an alpha-numeric string of length 8.