Random
To use the random library in your test, there's no need to install it via npm. Simply importing it will suffice.
/* LIBRARIES
*************/
const { sente } = require('#libraries');
const { random } = sente;
For detailed information, see: https://www.npmjs.com/package/random/v/3.0.6
USAGE
const { sente } = require('#libraries');
const { random } = sente;
// For convenience, several common uniform samplers are exposed directly
random.float() // 0.2149383367670885
random.int(0, 100) // 72
random.boolean() // true
// quick uniform shortcuts
random.float((min = 0), (max = 1)) // uniform float in [ min, max )
random.int((min = 0), (max = 1)) // uniform integer in [ min, max ]
random.boolean() // true or false
// uniform distribution
random.uniform((min = 0), (max = 1)) // () => [ min, max )
random.uniformInt((min = 0), (max = 1)) // () => [ min, max ]
random.uniformBoolean() // () => [ false, true ]
// normal distribution
random.normal((mu = 0), (sigma = 1))
random.logNormal((mu = 0), (sigma = 1))
// bernoulli distribution
random.bernoulli((p = 0.5))
random.binomial((n = 1), (p = 0.5))
random.geometric((p = 0.5))
// poisson distribution
random.poisson((lambda = 1))
random.exponential((lambda = 1))
// misc distribution
random.irwinHall(n)
random.bates(n)
random.pareto(alpha)
Last updated