Skip to content

A random integer generator that does not pick the same number twice until it runs out of unique numbers.

Notifications You must be signed in to change notification settings

mussinbenarbia/random-int-memoized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-int-memoized

Install

$ npm install random-int-memoized

Usage

Import/Require random-int-memoized

import { randomIntMemoized } from "random-int-memoized";
const { randomIntMemoized } = require("random-int-memoized");

Initialize random function and call it

const random = randomIntMemoized(1, 5);
console.log(random(), random(), random(), random(), random());
//=> 5 2 4 1 3

API

randomIntMemoized(lowerBound, upperBound)

Returns a function that when called will generate and return a random integer between and including the lowerBound and upperBound. The function will go through all numbers in the range before returning any given value twice.

Help / Feedback / Bugs

For help, feedback or, if you've found a bug please contact me at the following email address: contact@mussinben.com.

About

A random integer generator that does not pick the same number twice until it runs out of unique numbers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published