$ npm install random-int-memoized
import { randomIntMemoized } from "random-int-memoized";
const { randomIntMemoized } = require("random-int-memoized");
const random = randomIntMemoized(1, 5);
console.log(random(), random(), random(), random(), random());
//=> 5 2 4 1 3
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.