unique-random-array 1.0.0

Get consecutively unique elements from an array

Homepage: https://github.com/sindresorhus/unique-random-array

Platform: npm

Language: JavaScript

License: MIT

Keywords: unique, uniq, random, rand, number, single, generate, non-repeating, array, arr, item, element

View on registry: https://www.npmjs.com/package/unique-random-array

Direct download link: https://registry.npmjs.org/unique-random-array/-/unique-random-arra...

Install: npm install [email protected]

unique-random-array Build Status

Get consecutively unique elements from an array

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


$ npm install --save unique-random-array


var uniqueRandomArray = require('unique-random-array');
var rand = uniqueRandomArray([1, 2, 3, 4]);

console.log(rand(), rand(), rand(), rand());
//=> 4 2 1 4



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


Type: array



MIT © Sindre Sorhus


  • 1.0.0 - January 19, 2015 13:49

Project Statistics

SourceRank 18
Dependencies 1
Dependent projects 646
Dependent repositories 571
Total releases 1
Latest release
First release
Stars 27
Forks 0
Watchers 6
Contributors 1
Repo Size: 3.91 KB

Top Contributors See all

Sindre Sorhus

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2017-03-05 12:03:42 UTC

Login to resync this project