Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unique-random

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unique-random

Generate random numbers that are consecutively unique

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63K
increased by1.51%
Maintainers
1
Weekly downloads
 
Created
Source

unique-random Build Status

Generate random numbers that are consecutively unique.

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

Install

Download manually or with a package-manager.

$ npm install --save unique-random
$ bower install --save unique-random
$ component install sindresorhus/unique-random

Usage

Generate a random number between 1 and 10.

Node.js

var rand = require('unique-random')(1, 10);
console.log(rand(), rand(), rand());
//=> 5 2 6

Bower

<script src="bower_components/unique-random/unique-random.js"></script>
var rand = uniqueRandom(1, 10);
console.log(rand(), rand(), rand());
//=> 5 2 6

API

uniqueRandom(min, max)

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

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 29 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc