Package Exports
- random-number-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (random-number-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 } = require('random-number-string');
console.log(charSet);
console.log(randFlt());
console.log(randInt());
console.log(randStr());charSet
Includes some commonly used character sets like the alpha-numerics. Use it like this:
//These ones are properties:
console.log(charSet.LowerCase);
console.log(charSet.UpperCase);
console.log(charSet.Numeric);
console.log(charSet.PlusSlash);
console.log(charSet.Symbols);
console.log(charSet.Symbols2);
console.log(charSet.Brackets);
console.log(charSet.Quotes);
//These ones are methods that return the sets as strings:
console.log(charSet.Alpha());
console.log(charSet.AlphaNumeric());
console.log(charSet.AlphaNumericSymbol());
console.log(charSet.Base64());
console.log(charSet.Restricted());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.