Socket
Book a DemoInstallSign in
Socket

pick-random-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pick-random-stream

Uniformly pick a random value from a stream

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 16 Apr 2015

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