sindresorhus / unique-random

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

Not Working #8

Closed nivzelber closed 4 years ago

nivzelber commented 4 years ago

Just installed the package, cool idea BTW! Unfortunately I think it's not working correctly. the following code:

import uniqueRandom from "unique-random";

const random = uniqueRandom(1, 4);
console.log(random(), random(), random(), random());

sometimes has bad results (i.e 1, 2, 4, 2 or 4, 1, 3, 4). I've noticed it's never the same number twice in a row if that's helpfull.

sindresorhus commented 4 years ago

What is incorrect exactly?

From the description:

Generate random numbers that are consecutively unique

nivzelber commented 4 years ago

My bad. I was looking for a package that will return a different number from the range in each random() call. You can close this issue.

sindresorhus commented 4 years ago

I'm open to having that ability added, but I don't plan to work on this myself. https://github.com/sindresorhus/unique-random/issues/9