sindresorhus / unique-random

Generate random numbers that are consecutively unique
MIT License
116 stars 15 forks source link

same value? #5

Closed woodgear closed 5 years ago

woodgear commented 5 years ago
const uniqueRandom = require("unique-random")

const random = uniqueRandom(0, 2);

console.log(random(), random(), random());
sindresorhus commented 5 years ago

Not clear what you're asking.

woodgear commented 5 years ago

run this code under https://npm.runkit.com/unique-random mutli times. output could be below

1
0
1

and that is not unique

sindresorhus commented 5 years ago

Per the package description:

Generate random numbers that are consecutively unique

It only guarantees that the numbers are consecutively unique.