JSPM

random-array-index

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

Get the random index of an array

Package Exports

  • random-array-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-array-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-array-index

npm i --save random-array-index

usage

var randomArrayIndex = require('random-array-index')
var things = ['cat', 'dog', 'cactus', 'dinosaur', 'sloth', 'water bottle']
var idx = randomArrayIndex(things)

console.log(idx, things[idx])

api

randomArrayIndex(array)

Returns an integer from 0 to array.length - 1

license

MIT