Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "gaussian", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/errcw/gaussian", | ||
@@ -5,0 +5,0 @@ "authors": [ |
{ | ||
"name": "gaussian", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"main": "lib/gaussian.js", | ||
@@ -5,0 +5,0 @@ "scripts": [ |
(function(exports) { | ||
const generateGaussian = require('./box-muller'); | ||
// Complementary error function | ||
@@ -101,2 +103,11 @@ // From Numerical Recipes in C 2e p221 | ||
// Generate [num] random samples | ||
Gaussian.prototype.random = function(num){ | ||
let mean = this.mean; | ||
let std = this.standardDeviation; | ||
return Array(num).fill(0).map(() => { | ||
return generateGaussian(mean,std) | ||
}) | ||
}; | ||
var gaussian = function(mean, variance) { | ||
@@ -103,0 +114,0 @@ return new Gaussian(mean, variance); |
{ | ||
"name": "gaussian", | ||
"description": "A JavaScript model of a Gaussian distribution", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": "Eric Woroshow <eric@ericw.ca>", | ||
@@ -17,3 +17,4 @@ "homepage": "https://github.com/errcw/gaussian", | ||
"scripts": { | ||
"test": "nodeunit test" | ||
"test": "jest", | ||
"test:coverage": "jest --coverage" | ||
}, | ||
@@ -23,8 +24,15 @@ "engines": { | ||
}, | ||
"keywords": [ "gaussian", "normal", "distribution" ], | ||
"dependencies": { | ||
"keywords": [ | ||
"gaussian", | ||
"normal", | ||
"distribution" | ||
], | ||
"devDependencies": { | ||
"jest": "26.6.3" | ||
}, | ||
"devDependencies": { | ||
"nodeunit": ">= 0.7.x" | ||
"prettier": { | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2 | ||
} | ||
} |
@@ -34,1 +34,4 @@ # gaussian | ||
- `scale(c)`: returns the result of scaling this distribution by the given constant | ||
### Generation Function | ||
- `random(n)`: returns an array of generated `n` random samples correspoding to the Gaussian parameters. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11909
9
252
36
1