0.1.0 • Published 8 years ago

alternating-sample v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

alternating-sample

Provides a utility function to randomly select a value from a list of values, guaranteeing that consecutive retrievals return distinct values.

An example use case is selecting a background image from a pool of images, rendering a different image on every visit.

localStorage is used for persistence.

Usage

var alternatingSample = require('alternating-sample')(window)
var bgImage = alternatingSample('background', ['bg-1.jpg', 'bg-2.jpg', 'bg-3.jpg'])

License

Released under the MIT license.

0.1.0

8 years ago