guld-random
Cryptographically secure random number generator using /dev/urandom
with fallback to node's crypto
and finally to window.crypto || window.mscrypto
.
Install
Node
npm i guld-random
Browser
curl https///bitbucket.org/guld/tech-js-node_modules-guld-random/raw/guld/guld-random.min.js -o guld-random.min.js
Usage
// get random buffer of length 100
var buff = await getRandBuffer(100)
// get random, alphanumeric (default) string of length 100
var str = await getRandStr(100)
// get random, alphanumeric + special string of length 100
var str = await getRandStr(100, 'all')
// get random number less than or equal to 100
var num = await getRandInt(100)
Node
const { getHaystack, getRandBuffer, getRandStr, getRandInt } = require('guld-random')
License
MIT Copyright isysd