Not a Propaganda Machine
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

pick-random-stream

1.1.0 • Public • Published

pick-random-stream

Uniformly pick a random value from a stream

npm install pick-random-stream

build status

Usage

var random = require('pick-random-stream')
 
someStream.pipe(random()).on('data', function (data) {
  console.log('current random element is', data)
})

The random value will be chosen with propability 1/n where n is the total number of elements in the stream

License

MIT

Keywords

none

install

npm i pick-random-stream

Downloadsweekly downloads

3

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability