GithubHelp home page GithubHelp logo

dvisacker / randoma Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sindresorhus/randoma

0.0 1.0 0.0 4 KB

User-friendly pseudorandom number generator (PRNG)

License: MIT License

JavaScript 100.00%

randoma's Introduction

randoma Build Status

User-friendly pseudorandom number generator (PRNG)

This is not cryptographically secure.

Install

$ npm install randoma

Usage

const Randoma = require('randoma');

const random = new Randoma({seed: 10});

random.integer();
//=> 2027521326

random.integer();
//=> 677268843


(new Randoma({seed: '๐Ÿฆ„'}).integer());
//=> 1659974344

(new Randoma({seed: '๐Ÿฆ„'}).integer());
//=> 1659974344

API

const random = new Randoma(options)

options

Type: Object

seed

Required
Type: string integer

Initialization seed. Multiple instances of Randoma with the same seed will generate the same random numbers.

random.integer()

random.integerInRange(min, max)

random.float()

random.floatInRange(min, max)

random.boolean()

random.date()

random.dateInRange(startDate, endDate)

"Pull request welcome" for additional commonly used random methods.

Randoma.seed()

Returns a random seed you could use in the seed option if you for some reason don't want deterministic randomness.

Related

  • park-miller - Park-Miller pseudorandom number generator (PRNG)

License

MIT ยฉ Sindre Sorhus

randoma's People

Contributors

sindresorhus avatar

Watchers

David Van Isacker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.