Generate random numbers that are consecutively unique
Failed to load latest commit information.
.editorconfig tweaks Aug 13, 2014
.gitattributes init Nov 13, 2013
.gitignore init Nov 13, 2013
.jshintrc tweaks Aug 13, 2014
.travis.yml Update .travis.yml Feb 8, 2015
index.js tweaks Aug 13, 2014
license tweaks Aug 13, 2014
package.json minor tweaks Jan 19, 2015 Close #2 PR: Add unique-random-at-depth to the related repo list. Mar 8, 2016
test.js tweaks Aug 13, 2014

unique-random Build Status

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.


$ npm install --save unique-random


var uniqueRandom = require('unique-random');
var rand = uniqueRandom(1, 10);

console.log(rand(), rand(), rand());
//=> 5 2 6


uniqueRandom(min, max)

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



MIT © Sindre Sorhus