npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

randomizer-js

1.2.3 • Public • Published

randomizer-js

Build Status

Seeded random generator for Javascript

Node.js usage

npm install randomizer-js
var randomizer = require('randomizer-js');
 
// Autoseeded ARC4-based PRNG.
var rand = randomizer();
 
// Or
// Local PRNG: does not affect Math.random.
var rand = randomizer('my-seed');
 
console.log(rand.next());               // Always 12
console.log(rand.randomLetter())        // Always v
console.log(rand.randomWord())          // Always zzxulda
console.log(rand.randomSentence())      // Always pcheigs bobsdgzl cdqtbaxu
console.log(rand.randomParagraph())     // Always osij flosnqe paa. eesrdr ehwgqcu nuv. cwehk ue knpovxfer uxx...
var dob = rand.randomDoB()
console.log(dob)                        // Always 1949-06-04T22:00:00.000Z
console.log(rand.randomDoD(dob))        // Always 1969-07-25T22:00:00.000Z
console.log(rand.randomDate(20, 3))     // Always 2002-08-11T22:00:00.000Z
var ar = [410,120,360,470,850]
console.log(rand.randomArrayElement(ar))// Always 120
console.log(rand.randomFemaleName())    // Always Emerita
console.log(rand.randomMaleName())      // Always Gail
console.log(rand.randomBoolean())       // Always false
console.log(rand.randomPerson())
// Always
// {
//     isMale: true,
//     firstName: 'Wesley',
//     lastName: 'Bradley',
//     dob: 1988-11-07T22:00:00.000Z,
//     dod: undefined
// }

install

npm i randomizer-js

Downloadsweekly downloads

7

version

1.2.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability