JSPM

alias-sampling

0.5.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q33356F
  • License GPL

Library for sampling of random values from a discrete probability distribution, using the Walker-Vose alias method.

Package Exports

  • alias-sampling

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 (alias-sampling) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Alias Method for Sampling

Library for sampling of random values from a discrete probability distribution, using the Walker-Vose alias method.

Usage

var s = sample([0.5, 0.25, 0.25]);
s.next(); // => random index according to specified probabilities
var s = sample([0.5, 0.25, 0.25], [10, 20, 30]);
s.next(); // => random outcome according to specified probabilities

Build Status