All Projects → sindresorhus → randoma

sindresorhus / randoma

Licence: MIT License
User-friendly pseudorandom number generator (PRNG)

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to randoma

komihash
Very fast, high-quality hash function (non-cryptographic, C) + PRNG
Stars: ✭ 68 (-33.98%)
Mutual labels:  prng, pseudorandom
jsrand
A seeded pseudo-random number generator for JavaScript.
Stars: ✭ 19 (-81.55%)
Mutual labels:  prng, pseudorandom
prvhash
PRVHASH - Pseudo-Random-Value Hash. Hash functions, PRNG with unlimited period, randomness extractor. (Codename Gradilac/Градилак)
Stars: ✭ 194 (+88.35%)
Mutual labels:  prng, pseudorandom
nes-runner
An infinite runner NES game!
Stars: ✭ 28 (-72.82%)
Mutual labels:  prng
react-native-multi-toggle-switch
MultiToggle Switch for React-Native
Stars: ✭ 17 (-83.5%)
Mutual labels:  npm-package
code-frame
Minimal Code Frame like babel-code-frame, but smaller
Stars: ✭ 22 (-78.64%)
Mutual labels:  npm-package
couchbase-index-manager
Command-line interface to manage Couchbase indexes, synchronizing them to index definitions.
Stars: ✭ 14 (-86.41%)
Mutual labels:  npm-package
impression
👀Element view notifier
Stars: ✭ 77 (-25.24%)
Mutual labels:  npm-package
Nodorithm
NPM package for algorithms.
Stars: ✭ 22 (-78.64%)
Mutual labels:  npm-package
mdi-cli
Generate material design icons from the command line
Stars: ✭ 68 (-33.98%)
Mutual labels:  npm-package
hapi-sentry
A hapi plugin for request error logging to Sentry
Stars: ✭ 24 (-76.7%)
Mutual labels:  npm-package
picsort
Organize your photos by date in one click 👏
Stars: ✭ 22 (-78.64%)
Mutual labels:  npm-package
check-disk-space
Light multi-platform disk space checker without third-party for Node.js
Stars: ✭ 55 (-46.6%)
Mutual labels:  npm-package
nuxt-mail
Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Stars: ✭ 62 (-39.81%)
Mutual labels:  npm-package
node.js-chatbot
Zoom Node.js Chatbot Library
Stars: ✭ 19 (-81.55%)
Mutual labels:  npm-package
next-gen-ui
www.npmjs.com/package/next-gen-ui
Stars: ✭ 24 (-76.7%)
Mutual labels:  npm-package
ionic-image-upload
Ionic Plugin for Uploading Images to Amazon S3
Stars: ✭ 26 (-74.76%)
Mutual labels:  npm-package
e
A library which combines a eventBus/emitter, DOM events management, delegated events, and event-based utils into a single lightweight and performant library.
Stars: ✭ 37 (-64.08%)
Mutual labels:  npm-package
iconic-input
Beautiful Input components for React Native... <IconicTextbox/> and much more!
Stars: ✭ 22 (-78.64%)
Mutual labels:  npm-package
is-safe-integer
ES2015 Number.isSafeInteger() ponyfill
Stars: ✭ 16 (-84.47%)
Mutual labels:  npm-package

randoma

User-friendly pseudorandom number generator (PRNG)

This is not cryptographically secure.

“Pull request welcome” for additional commonly used random methods.

Install

npm install randoma

Usage

import Randoma from '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 | number

Initialization seed.

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

random.integer()

random.integerInRange(minimum, maximum)

random.float()

random.floatInRange(minimum, maximum)

random.boolean()

random.arrayItem(array)

random.date()

random.dateInRange(startDate, endDate)

random.color(saturation?)

Returns a random aesthetically pleasing color as a color object.

random.color(0.5).hex().toString()
//=> '#AAF2B0'
saturation

Type: number
Default: 0.5

A percentage in the range 0...1.

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)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].