Documentation - nssmmn/candies GitHub Wiki

Home / Documentation

Documentation

Installing

For installing Candies :

npm install candies

Usage

var C = require('candies');

var n = 10,
    values = ['mint','orange','strawberry'],
    weight = [.2,.3,.5];

var sample = C.urn(n,value,weight);
// generate randomly a sample of 10.

If you want to use this package in browser, use browserify. Create a file named main.js that contains the following code :

global.C = require('candies');

Install the Candies package :

npm install candies

And run the following command :

browserify main.js -o candies.js

Now you can use Candies library in your browser under the C namespace by adding this tag to your html page :

<script src="candies.js"></script>

Generators

Until now there are eight (08) generators, seven (07) follow probability distributions, and the last represents an urn.

Available generators are:

  • Uniform distribution (discrete and continuous).
  • Bernouli distribution.
  • Binomial distribution.
  • Poisson distribution.
  • Normal (Gaussian) distribution.
  • Exponential distribution.
  • Pareto distribution.
  • Urn.

For more details please see the generators documentation.

⚠️ **GitHub.com Fallback** ⚠️