secure-sample
Secure, sequential (n, N) sampling without replacement
Last updated 6 months ago by emilbayes .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install secure-sample 
SYNC missed versions from official npm registry.

secure-sample

Secure, sequential (n, N) sampling without replacement

Usage

var sample = require('secure-sample')

sample(3, 10) // [0, 5, 9]

Random order sample:

var sample = require('secure-sample')
var shuffle = require('secure-shuffle')

shuffle(sample(3, 10)) // [6, 2, 8]

API

secureSample(sampleSize, populationSize)

Will return an array with sampleSize number of unique samples from the uniform distribution [0, populationSize) (populationSize exclusive). The samples will be sequential, so you may want to shuffle them. See Related for relevant module.

sampleSize and populationSize must be safe integers. sampleSize must not be larger than populationSize. If any of these conditions are violated, an error will be thrown. Something like unassertify

Install

npm install secure-shuffle

Related

Reference

John D. Cook on Stack Overflow

License

ISC

Current Tags

  • 2.0.0                                ...           latest (6 months ago)

5 Versions

  • 2.0.0                                ...           6 months ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 4
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |