@elonehoo/only-random
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

only-random

NPM version

Generate random numbers that are consecutively unique

Useful for things like slideshows where you don't want to have the same slide twice in a row.

install

# npm
npm install --save @elonehoo/only-random
# yarn
yarn add --save @elonehoo/only-random
# pnpm
pnpm install --save @elonehoo/only-random

usage

import onlyRandom from '@elonehoo/only-random'

const random = onlyRandom(1, 10)

console.log(random(), random(), random())

API

onlyRandom(minimum:number, maximum:number)

Returns a function, that when called, will return a random number that is never the same as the previous.

Readme

Keywords

none

Package Sidebar

Install

npm i @elonehoo/only-random

Weekly Downloads

5

Version

0.0.9

License

MIT

Unpacked Size

4.25 kB

Total Files

8

Last publish

Collaborators

  • elonehoo