Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    seeded-randompublic

    seeded-random

    Node package that allows you to generate seeded random numbers for your cli or web applications.

    Installing

    CLI

    npm install -g seeded-random

    Node project

    npm install --save seeded-random

    Examples

    CLI

    Generating a random decimal number

    $ seeded-random -d

    Generating a random decimal number from a seed

    $ seeded-random -d -s thisisaseed

    0.9044537395238876

    Generating a random integer within a range from a seed

    $ seeded-random -r 1,6 -s thisisaseed

    2

    Omitting the seed will result it a non-seeded random number; it will just be generated as normal.

    JavaScript

    Generating a random decimal number from a seed

    var random = require('seeded-random');
     
    console.log(random.decimal('thisisaseed'));

    Generating a random integer within a range from a seed

    var random = require('seeded-random');
     
    console.log(random.range('thisisaseed', 1, 6));

    Selecting a random array element

    var random = require('seeded-random');
     
    console.log(random.element('thisisaseed', ['heads', 'tails']));

    install

    npm i seeded-random

    Downloadsweekly downloads

    10

    version

    1.0.1

    license

    GPL-3.0

    repository

    github.com

    last publish

    collaborators

    • avatar