Wondering what’s next for npm?Check out our public roadmap! »

    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

    10

    Version

    1.2.3

    License

    MIT

    Unpacked Size

    15.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar