JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4453
  • Score
    100M100P100Q118606F
  • License MIT

Return a random array-like index.

Package Exports

  • random-index

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (random-index) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

random-index

Return a random array-like index.

MIT License

build:? coverage:?

Install

$ npm install --save random-index 

Usage

For more use-cases see the tests

var randomIndex = require('random-index');

// API:
// - randomIndex();
// - randomIndex(max);

randomIndex();     // => 0~4294967295           
randomIndex(1);    // => 0~1
randomIndex('10'); // => 0~10   

The max is inclusive, this means randomIndex(2) would return either 0, 1, or 2.

  • pick-item - Randomly sampling a item from an array.
  • pick-items - Randomly sampling some items from an array.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.