From 0e8f0401aaf48e2b6fa61d48afd70a47def55e92 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Mon, 29 Jan 2024 02:34:56 +0000 Subject: [PATCH] Update artifacts --- ndarray/broadcast-array/coverage.ndjson | 1 + ndarray/broadcast-array/index.html | 2 +- ndarray/broadcast-array/index.js.html | 2 +- ndarray/broadcast-array/main.js.html | 2 +- random/array/geometric/coverage.ndjson | 1 + random/array/geometric/factory.js.html | 2 +- random/array/geometric/index.html | 2 +- random/array/geometric/index.js.html | 2 +- random/array/geometric/main.js.html | 2 +- random/array/rayleigh/coverage.ndjson | 1 + random/array/rayleigh/factory.js.html | 2 +- random/array/rayleigh/index.html | 2 +- random/array/rayleigh/index.js.html | 2 +- random/array/rayleigh/main.js.html | 2 +- random/base/chi/coverage.ndjson | 1 + random/base/chi/factory.js.html | 2 +- random/base/chi/index.html | 2 +- random/base/chi/index.js.html | 2 +- random/base/chi/main.js.html | 2 +- random/base/erlang/coverage.ndjson | 1 + random/base/erlang/erlang.js.html | 247 +++++++ random/base/erlang/factory.js.html | 940 ++++++++++++++++++++++++ random/base/erlang/index.html | 176 +++++ random/base/erlang/index.js.html | 256 +++++++ random/base/erlang/main.js.html | 262 +++++++ random/base/erlang/validate.js.html | 256 +++++++ random/base/gumbel/coverage.ndjson | 1 + random/base/gumbel/factory.js.html | 907 +++++++++++++++++++++++ random/base/gumbel/gumbel.js.html | 217 ++++++ random/base/gumbel/index.html | 176 +++++ random/base/gumbel/index.js.html | 286 +++++++ random/base/gumbel/main.js.html | 235 ++++++ random/base/gumbel/validate.js.html | 259 +++++++ random/base/poisson/coverage.ndjson | 1 + random/base/poisson/factory.js.html | 2 +- random/base/poisson/index.html | 2 +- random/base/poisson/index.js.html | 2 +- random/base/poisson/knuth.js.html | 20 +- random/base/poisson/main.js.html | 2 +- random/base/poisson/poisson.js.html | 8 +- random/base/poisson/rejection.js.html | 124 ++-- 41 files changed, 4319 insertions(+), 95 deletions(-) create mode 100644 random/base/erlang/coverage.ndjson create mode 100644 random/base/erlang/erlang.js.html create mode 100644 random/base/erlang/factory.js.html create mode 100644 random/base/erlang/index.html create mode 100644 random/base/erlang/index.js.html create mode 100644 random/base/erlang/main.js.html create mode 100644 random/base/erlang/validate.js.html create mode 100644 random/base/gumbel/coverage.ndjson create mode 100644 random/base/gumbel/factory.js.html create mode 100644 random/base/gumbel/gumbel.js.html create mode 100644 random/base/gumbel/index.html create mode 100644 random/base/gumbel/index.js.html create mode 100644 random/base/gumbel/main.js.html create mode 100644 random/base/gumbel/validate.js.html diff --git a/ndarray/broadcast-array/coverage.ndjson b/ndarray/broadcast-array/coverage.ndjson index d37e65664..25396016a 100644 --- a/ndarray/broadcast-array/coverage.ndjson +++ b/ndarray/broadcast-array/coverage.ndjson @@ -2,3 +2,4 @@ [226,226,100,23,23,100,1,1,100,226,226,100,"71d561cc2b942a92983a38c8bde009d35255c5d1","2023-10-09 17:25:37 -0700"] [226,226,100,23,23,100,1,1,100,226,226,100,"b8f8c28db9816e6fb5b0cee0ad61f377f6815d65","2023-10-12 01:00:56 -0700"] [226,226,100,23,23,100,1,1,100,226,226,100,"a49bb3d59e055b9ce2d393132673b5d901977f75","2023-11-09 02:50:07 -0800"] +[226,226,100,23,23,100,1,1,100,226,226,100,"42b1c7e18fadf89854f359a3a01cf37c66dd66cc","2024-01-28 21:33:01 -0500"] diff --git a/ndarray/broadcast-array/index.html b/ndarray/broadcast-array/index.html index 1d0467d21..c1ada57bd 100644 --- a/ndarray/broadcast-array/index.html +++ b/ndarray/broadcast-array/index.html @@ -116,7 +116,7 @@

All files ndarray/broadcast-array/lib

+ + + + + + \ No newline at end of file diff --git a/random/base/erlang/factory.js.html b/random/base/erlang/factory.js.html new file mode 100644 index 000000000..e9370f5f6 --- /dev/null +++ b/random/base/erlang/factory.js.html @@ -0,0 +1,940 @@ + + + + + + Code coverage report for random/base/erlang/lib/factory.js + + + + + + + + + +
+
+

All files / random/base/erlang/lib factory.js

+
+ +
+ 100% + Statements + 285/285 +
+ + +
+ 100% + Branches + 45/45 +
+ + +
+ 100% + Functions + 10/10 +
+ + +
+ 100% + Lines + 285/285 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +2862x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +136x +136x +136x +136x +136x +136x +136x +136x +136x +14x +136x +66x +66x +9x +9x +66x +19x +9x +9x +10x +66x +38x +38x +122x +56x +56x +56x +56x +23x +23x +56x +28x +28x +9x +9x +28x +12x +9x +9x +3x +28x +7x +7x +56x +5x +5x +56x +136x +26x +136x +15x +15x +41x +41x +41x +136x +13x +13x +13x +13x +13x +13x +13x +136x +28x +28x +28x +28x +28x +28x +28x +28x +28x +41x +41x +41x +41x +41x +41x +41x +41x +41x +4x +4x +41x +41x +41x +41x +41x +41x +41x +41x +2x +2x +41x +41x +41x +41x +41x +41x +41x +41x +2x +2x +41x +41x +41x +41x +41x +41x +41x +41x +2x +2x +41x +41x +41x +41x +41x +41x +41x +41x +7x +7x +41x +41x +41x +41x +41x +41x +41x +41x +41x +3x +3x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +2x +2x +2x +2x +2x +1x +1x +1x +1x +2x +2x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +1800x +1800x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +41x +807x +807x +807x +807x +802x +807x +7x +7x +800x +807x +136x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var setReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' );
+var setReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' );
+var isObject = require( '@stdlib/assert/is-plain-object' );
+var isFunction = require( '@stdlib/assert/is-function' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var constantFunction = require( '@stdlib/utils/constant-function' );
+var noop = require( '@stdlib/utils/noop' );
+var randu = require( '@stdlib/random/base/mt19937' ).factory;
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var isPositiveInteger = require( '@stdlib/math/base/assert/is-positive-integer' );
+var typedarray2json = require( '@stdlib/array/to-json' );
+var format = require( '@stdlib/string/format' );
+var validate = require( './validate.js' );
+var erlang0 = require( './erlang.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a pseudorandom number generator for generating Erlang distributed random numbers.
+*
+* @param {PositiveInteger} [k] - shape parameter
+* @param {PositiveNumber} [lambda] - rate parameter
+* @param {Options} [options] - function options
+* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers
+* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed
+* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
+* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
+* @throws {TypeError} `k` must be a positive integer
+* @throws {TypeError} `lambda` must be a positive number
+* @throws {TypeError} options argument must be an object
+* @throws {TypeError} must provide valid options
+* @throws {Error} must provide a valid state
+* @returns {PRNG} pseudorandom number generator
+*
+* @example
+* var erlang = factory( 2, 1.0 );
+* var v = erlang();
+* // returns <number>
+*
+* @example
+* var erlang = factory( 2, 2.0, {
+*     'seed': 297
+* });
+* var v = erlang();
+* // returns <number>
+*/
+function factory() {
+	var lambda;
+	var rand;
+	var opts;
+	var prng;
+	var err;
+	var k;
+ 
+	if ( arguments.length === 0 ) {
+		rand = randu();
+	} else if ( arguments.length === 1 ) {
+		opts = arguments[ 0 ];
+		if ( !isObject( opts ) ) {
+			throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
+		}
+		if ( hasOwnProp( opts, 'prng' ) ) {
+			if ( !isFunction( opts.prng ) ) {
+				throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );
+			}
+			rand = opts.prng;
+		} else {
+			rand = randu( opts );
+		}
+	} else {
+		k = arguments[ 0 ];
+		lambda = arguments[ 1 ];
+		err = validate( k, lambda );
+		if ( err ) {
+			throw err;
+		}
+		if ( arguments.length > 2 ) {
+			opts = arguments[ 2 ];
+			if ( !isObject( opts ) ) {
+				throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
+			}
+			if ( hasOwnProp( opts, 'prng' ) ) {
+				if ( !isFunction( opts.prng ) ) {
+					throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );
+				}
+				rand = opts.prng;
+			} else {
+				rand = randu( opts );
+			}
+		} else {
+			rand = randu();
+		}
+	}
+	if ( k === void 0 ) {
+		prng = erlang2;
+	} else {
+		prng = erlang1;
+	}
+	setReadOnly( prng, 'NAME', 'erlang' );
+ 
+	// If we are provided an "external" PRNG, we don't support getting or setting PRNG state, as we'd need to check for compatible state value types, etc, entailing considerable complexity.
+	if ( opts && opts.prng ) {
+		setReadOnly( prng, 'seed', null );
+		setReadOnly( prng, 'seedLength', null );
+		setReadWriteAccessor( prng, 'state', constantFunction( null ), noop );
+		setReadOnly( prng, 'stateLength', null );
+		setReadOnly( prng, 'byteLength', null );
+		setReadOnly( prng, 'toJSON', constantFunction( null ) );
+		setReadOnly( prng, 'PRNG', rand );
+	} else {
+		setReadOnlyAccessor( prng, 'seed', getSeed );
+		setReadOnlyAccessor( prng, 'seedLength', getSeedLength );
+		setReadWriteAccessor( prng, 'state', getState, setState );
+		setReadOnlyAccessor( prng, 'stateLength', getStateLength );
+		setReadOnlyAccessor( prng, 'byteLength', getStateSize );
+		setReadOnly( prng, 'toJSON', toJSON );
+		setReadOnly( prng, 'PRNG', rand );
+		rand = rand.normalized;
+	}
+	return prng;
+ 
+	/**
+	* Returns the PRNG seed.
+	*
+	* @private
+	* @returns {PRNGSeedMT19937} seed
+	*/
+	function getSeed() {
+		return rand.seed;
+	}
+ 
+	/**
+	* Returns the PRNG seed length.
+	*
+	* @private
+	* @returns {PositiveInteger} seed length
+	*/
+	function getSeedLength() {
+		return rand.seedLength;
+	}
+ 
+	/**
+	* Returns the PRNG state length.
+	*
+	* @private
+	* @returns {PositiveInteger} state length
+	*/
+	function getStateLength() {
+		return rand.stateLength;
+	}
+ 
+	/**
+	* Returns the PRNG state size (in bytes).
+	*
+	* @private
+	* @returns {PositiveInteger} state size (in bytes)
+	*/
+	function getStateSize() {
+		return rand.byteLength;
+	}
+ 
+	/**
+	* Returns the current pseudorandom number generator state.
+	*
+	* @private
+	* @returns {PRNGStateMT19937} current state
+	*/
+	function getState() {
+		return rand.state;
+	}
+ 
+	/**
+	* Sets the pseudorandom number generator state.
+	*
+	* @private
+	* @param {PRNGStateMT19937} s - generator state
+	* @throws {Error} must provide a valid state
+	*/
+	function setState( s ) {
+		rand.state = s;
+	}
+ 
+	/**
+	* Serializes the pseudorandom number generator as a JSON object.
+	*
+	* ## Notes
+	*
+	* -   `JSON.stringify()` implicitly calls this method when stringifying a PRNG.
+	*
+	* @private
+	* @returns {Object} JSON representation
+	*/
+	function toJSON() {
+		var out = {};
+		out.type = 'PRNG';
+		out.name = prng.NAME;
+		out.state = typedarray2json( rand.state );
+		if ( k === void 0 ) {
+			out.params = [];
+		} else {
+			out.params = [ k, lambda ];
+		}
+		return out;
+	}
+ 
+	/**
+	* Returns a pseudorandom number drawn from an Erlang distribution with bound parameters.
+	*
+	* @private
+	* @returns {number} pseudorandom number
+	*
+	* @example
+	* var v = erlang1();
+	* // returns <number>
+	*/
+	function erlang1() {
+		return erlang0( rand, k, lambda );
+	}
+ 
+	/**
+	* Returns a pseudorandom number drawn from an Erlang distribution.
+	*
+	* @private
+	* @param {PositiveInteger} k - shape parameter
+	* @param {PositiveNumber} lambda - rate parameter
+	* @returns {number} pseudorandom number
+	*
+	* @example
+	* var v = erlang2( 2, 1.0 );
+	* // returns <number>
+	*
+	* @example
+	* var v = erlang2( NaN, 1.0 );
+	* // returns NaN
+	*
+	* v = erlang2( 2, NaN );
+	* // returns NaN
+	*
+	* v = erlang2( 3.14, 1.0 );
+	* // returns NaN
+	*
+	* v = erlang2( 2, 0.0 );
+	* // returns NaN
+	*/
+	function erlang2( k, lambda ) {
+		if (
+			isnan( k ) ||
+			isnan( lambda ) ||
+			!isPositiveInteger( k ) ||
+			lambda <= 0.0
+		) {
+			return NaN;
+		}
+		return erlang0( rand, k, lambda );
+	}
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = factory;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/erlang/index.html b/random/base/erlang/index.html new file mode 100644 index 000000000..1f177ed55 --- /dev/null +++ b/random/base/erlang/index.html @@ -0,0 +1,176 @@ + + + + + + Code coverage report for random/base/erlang/lib + + + + + + + + + +
+
+

All files random/base/erlang/lib

+
+ +
+ 100% + Statements + 512/512 +
+ + +
+ 100% + Branches + 56/56 +
+ + +
+ 100% + Functions + 12/12 +
+ + +
+ 100% + Lines + 512/512 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
erlang.js +
+
100%54/54100%3/3100%1/1100%54/54
factory.js +
+
100%285/285100%45/45100%10/10100%285/285
index.js +
+
100%57/57100%1/1100%0/0100%57/57
main.js +
+
100%59/59100%1/1100%0/0100%59/59
validate.js +
+
100%57/57100%6/6100%1/1100%57/57
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/erlang/index.js.html b/random/base/erlang/index.js.html new file mode 100644 index 000000000..c31648dec --- /dev/null +++ b/random/base/erlang/index.js.html @@ -0,0 +1,256 @@ + + + + + + Code coverage report for random/base/erlang/lib/index.js + + + + + + + + + +
+
+

All files / random/base/erlang/lib index.js

+
+ +
+ 100% + Statements + 57/57 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 57/57 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +581x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+/**
+* Erlang distributed pseudorandom numbers.
+*
+* @module @stdlib/random/base/erlang
+*
+* @example
+* var erlang = require( '@stdlib/random/base/erlang' );
+*
+* var v = erlang( 3, 2.5 );
+* // returns <number>
+*
+* @example
+* var factory = require( '@stdlib/random/base/erlang' ).factory;
+*
+* var erlang = factory( 8, 5.9, {
+*     'seed': 297
+* });
+*
+* var v = erlang();
+* // returns <number>
+*/
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( main, 'factory', factory );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = main;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/erlang/main.js.html b/random/base/erlang/main.js.html new file mode 100644 index 000000000..e1f3d6649 --- /dev/null +++ b/random/base/erlang/main.js.html @@ -0,0 +1,262 @@ + + + + + + Code coverage report for random/base/erlang/lib/main.js + + + + + + + + + +
+
+

All files / random/base/erlang/lib main.js

+
+ +
+ 100% + Statements + 59/59 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 59/59 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +601x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a pseudorandom number drawn from an Erlang distribution.
+*
+* @name erlang
+* @type {PRNG}
+* @param {PositiveInteger} k - shape parameter
+* @param {PositiveNumber} lambda - rate parameter
+* @returns {number} pseudorandom number
+*
+* @example
+* var v = erlang( 2, 1.0 );
+* // returns <number>
+*
+* @example
+* var v = erlang( NaN, 1.0 );
+* // returns NaN
+*
+* v = erlang( 2, NaN );
+* // returns NaN
+*
+* v = erlang( 3.14, 1.0 );
+* // returns NaN
+*
+* v = erlang( 3, 0.0 );
+* // returns NaN
+*/
+var erlang = factory();
+ 
+ 
+// EXPORTS //
+ 
+module.exports = erlang;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/erlang/validate.js.html b/random/base/erlang/validate.js.html new file mode 100644 index 000000000..7479e8a4f --- /dev/null +++ b/random/base/erlang/validate.js.html @@ -0,0 +1,256 @@ + + + + + + Code coverage report for random/base/erlang/lib/validate.js + + + + + + + + + +
+
+

All files / random/base/erlang/lib validate.js

+
+ +
+ 100% + Statements + 57/57 +
+ + +
+ 100% + Branches + 6/6 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 57/57 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +582x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +56x +56x +12x +12x +56x +11x +11x +33x +56x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var isPositive = require( '@stdlib/assert/is-positive-number' ).isPrimitive;
+var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
+var format = require( '@stdlib/string/format' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Validates parameters.
+*
+* @private
+* @param {PositiveInteger} k - shape parameter
+* @param {PositiveNumber} lambda - rate parameter
+* @returns {(Error|null)} error or null
+*
+* @example
+* var err = validate( 1, 2.5 );
+* if ( err ) {
+*     throw err;
+* }
+*/
+function validate( k, lambda ) {
+	if ( !isPositiveInteger( k ) ) {
+		return new TypeError( format( 'invalid argument. First argument must be a positive integer. Value: `%s`.', k ) );
+	}
+	if ( !isPositive( lambda ) ) {
+		return new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', lambda ) );
+	}
+	return null;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = validate;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/gumbel/coverage.ndjson b/random/base/gumbel/coverage.ndjson new file mode 100644 index 000000000..7c65bde9a --- /dev/null +++ b/random/base/gumbel/coverage.ndjson @@ -0,0 +1 @@ +[493,493,100,55,55,100,12,12,100,493,493,100,"42b1c7e18fadf89854f359a3a01cf37c66dd66cc","2024-01-28 21:33:01 -0500"] diff --git a/random/base/gumbel/factory.js.html b/random/base/gumbel/factory.js.html new file mode 100644 index 000000000..c93bad7ec --- /dev/null +++ b/random/base/gumbel/factory.js.html @@ -0,0 +1,907 @@ + + + + + + Code coverage report for random/base/gumbel/lib/factory.js + + + + + + + + + +
+
+

All files / random/base/gumbel/lib factory.js

+
+ +
+ 100% + Statements + 274/274 +
+ + +
+ 100% + Branches + 44/44 +
+ + +
+ 100% + Functions + 10/10 +
+ + +
+ 100% + Lines + 274/274 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +2752x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +132x +132x +132x +132x +132x +132x +132x +132x +132x +13x +132x +66x +66x +9x +9x +66x +19x +9x +9x +10x +66x +38x +38x +119x +53x +53x +53x +53x +20x +20x +53x +28x +28x +9x +9x +28x +12x +9x +9x +3x +28x +7x +7x +53x +5x +5x +53x +132x +25x +132x +15x +15x +40x +40x +40x +132x +13x +13x +13x +13x +13x +13x +13x +132x +27x +27x +27x +27x +27x +27x +27x +27x +27x +40x +40x +40x +40x +40x +40x +40x +40x +40x +4x +4x +40x +40x +40x +40x +40x +40x +40x +40x +2x +2x +40x +40x +40x +40x +40x +40x +40x +40x +2x +2x +40x +40x +40x +40x +40x +40x +40x +40x +2x +2x +40x +40x +40x +40x +40x +40x +40x +40x +7x +7x +40x +40x +40x +40x +40x +40x +40x +40x +40x +3x +3x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +2x +2x +2x +2x +2x +1x +1x +1x +1x +2x +2x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +1800x +1800x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +40x +805x +805x +805x +802x +805x +5x +5x +800x +805x +132x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var setReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' );
+var setReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' );
+var isObject = require( '@stdlib/assert/is-plain-object' );
+var isFunction = require( '@stdlib/assert/is-function' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var constantFunction = require( '@stdlib/utils/constant-function' );
+var noop = require( '@stdlib/utils/noop' );
+var randu = require( '@stdlib/random/base/mt19937' ).factory;
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var typedarray2json = require( '@stdlib/array/to-json' );
+var format = require( '@stdlib/string/format' );
+var validate = require( './validate.js' );
+var gumbel0 = require( './gumbel.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a pseudorandom number generator for generating random numbers from a Gumbel distribution.
+*
+* @param {number} [mu] - mean
+* @param {PositiveNumber} [beta] - scale parameter
+* @param {Options} [options] - function options
+* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers
+* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed
+* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
+* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
+* @throws {TypeError} `mu` must be a number
+* @throws {TypeError} `beta` must be a positive number
+* @throws {TypeError} options argument must be an object
+* @throws {TypeError} must provide valid options
+* @throws {Error} must provide a valid state
+* @returns {PRNG} pseudorandom number generator
+*
+* @example
+* var gumbel = factory( 0.0, 1.0 );
+* var v = gumbel();
+* // returns <number>
+*
+* @example
+* var gumbel = factory( -3.0, 0.5, {
+*     'seed': 297
+* });
+* var v = gumbel();
+* // returns <number>
+*/
+function factory() {
+	var beta;
+	var opts;
+	var rand;
+	var prng;
+	var err;
+	var mu;
+ 
+	if ( arguments.length === 0 ) {
+		rand = randu();
+	} else if ( arguments.length === 1 ) {
+		opts = arguments[ 0 ];
+		if ( !isObject( opts ) ) {
+			throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
+		}
+		if ( hasOwnProp( opts, 'prng' ) ) {
+			if ( !isFunction( opts.prng ) ) {
+				throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );
+			}
+			rand = opts.prng;
+		} else {
+			rand = randu( opts );
+		}
+	} else {
+		mu = arguments[ 0 ];
+		beta = arguments[ 1 ];
+		err = validate( mu, beta );
+		if ( err ) {
+			throw err;
+		}
+		if ( arguments.length > 2 ) {
+			opts = arguments[ 2 ];
+			if ( !isObject( opts ) ) {
+				throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
+			}
+			if ( hasOwnProp( opts, 'prng' ) ) {
+				if ( !isFunction( opts.prng ) ) {
+					throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );
+				}
+				rand = opts.prng;
+			} else {
+				rand = randu( opts );
+			}
+		} else {
+			rand = randu();
+		}
+	}
+	if ( mu === void 0 ) {
+		prng = gumbel2;
+	} else {
+		prng = gumbel1;
+	}
+	setReadOnly( prng, 'NAME', 'gumbel' );
+ 
+	// If we are provided an "external" PRNG, we don't support getting or setting PRNG state, as we'd need to check for compatible state value types, etc, entailing considerable complexity.
+	if ( opts && opts.prng ) {
+		setReadOnly( prng, 'seed', null );
+		setReadOnly( prng, 'seedLength', null );
+		setReadWriteAccessor( prng, 'state', constantFunction( null ), noop );
+		setReadOnly( prng, 'stateLength', null );
+		setReadOnly( prng, 'byteLength', null );
+		setReadOnly( prng, 'toJSON', constantFunction( null ) );
+		setReadOnly( prng, 'PRNG', rand );
+	} else {
+		setReadOnlyAccessor( prng, 'seed', getSeed );
+		setReadOnlyAccessor( prng, 'seedLength', getSeedLength );
+		setReadWriteAccessor( prng, 'state', getState, setState );
+		setReadOnlyAccessor( prng, 'stateLength', getStateLength );
+		setReadOnlyAccessor( prng, 'byteLength', getStateSize );
+		setReadOnly( prng, 'toJSON', toJSON );
+		setReadOnly( prng, 'PRNG', rand );
+		rand = rand.normalized;
+	}
+	return prng;
+ 
+	/**
+	* Returns the PRNG seed.
+	*
+	* @private
+	* @returns {PRNGSeedMT19937} seed
+	*/
+	function getSeed() {
+		return rand.seed;
+	}
+ 
+	/**
+	* Returns the PRNG seed length.
+	*
+	* @private
+	* @returns {PositiveInteger} seed length
+	*/
+	function getSeedLength() {
+		return rand.seedLength;
+	}
+ 
+	/**
+	* Returns the PRNG state length.
+	*
+	* @private
+	* @returns {PositiveInteger} state length
+	*/
+	function getStateLength() {
+		return rand.stateLength;
+	}
+ 
+	/**
+	* Returns the PRNG state size (in bytes).
+	*
+	* @private
+	* @returns {PositiveInteger} state size (in bytes)
+	*/
+	function getStateSize() {
+		return rand.byteLength;
+	}
+ 
+	/**
+	* Returns the current pseudorandom number generator state.
+	*
+	* @private
+	* @returns {PRNGStateMT19937} current state
+	*/
+	function getState() {
+		return rand.state;
+	}
+ 
+	/**
+	* Sets the pseudorandom number generator state.
+	*
+	* @private
+	* @param {PRNGStateMT19937} s - generator state
+	* @throws {Error} must provide a valid state
+	*/
+	function setState( s ) {
+		rand.state = s;
+	}
+ 
+	/**
+	* Serializes the pseudorandom number generator as a JSON object.
+	*
+	* ## Notes
+	*
+	* -   `JSON.stringify()` implicitly calls this method when stringifying a PRNG.
+	*
+	* @private
+	* @returns {Object} JSON representation
+	*/
+	function toJSON() {
+		var out = {};
+		out.type = 'PRNG';
+		out.name = prng.NAME;
+		out.state = typedarray2json( rand.state );
+		if ( mu === void 0 ) {
+			out.params = [];
+		} else {
+			out.params = [ mu, beta ];
+		}
+		return out;
+	}
+ 
+	/**
+	* Returns pseudorandom number drawn from a Gumbel distribution with bound parameters.
+	*
+	* @private
+	* @returns {number} pseudorandom number
+	*
+	* @example
+	* var v = gumbel1();
+	* // returns <number>
+	*/
+	function gumbel1() {
+		return gumbel0( rand, mu, beta );
+	}
+ 
+	/**
+	* Returns pseudorandom number drawn from a Gumbel distribution.
+	*
+	* @private
+	* @param {number} mu - mean
+	* @param {PositiveNumber} beta - scale parameter
+	* @returns {number} pseudorandom number
+	*
+	* @example
+	* var v = gumbel2( 0.0, 2.0 );
+	* // returns <number>
+	*
+	* @example
+	* var v = gumbel2( 0.0, -1.0 );
+	* // returns NaN
+	*/
+	function gumbel2( mu, beta ) {
+		if (
+			isnan( mu ) ||
+			isnan( beta ) ||
+			beta <= 0.0
+		) {
+			return NaN;
+		}
+		return gumbel0( rand, mu, beta );
+	}
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = factory;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/gumbel/gumbel.js.html b/random/base/gumbel/gumbel.js.html new file mode 100644 index 000000000..db1b82d33 --- /dev/null +++ b/random/base/gumbel/gumbel.js.html @@ -0,0 +1,217 @@ + + + + + + Code coverage report for random/base/gumbel/lib/gumbel.js + + + + + + + + + +
+
+

All files / random/base/gumbel/lib gumbel.js

+
+ +
+ 100% + Statements + 44/44 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 44/44 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +452x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2600x +2600x +2600x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var ln = require( '@stdlib/math/base/special/ln' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns pseudorandom number drawn from a Gumbel distribution.
+*
+* @private
+* @param {PRNG} rand - PRNG for generating uniformly distributed numbers
+* @param {number} mu - mean
+* @param {PositiveNumber} beta - scale parameter
+* @returns {number} pseudorandom number
+*/
+function gumbel( rand, mu, beta ) {
+	return mu - ( beta*ln( -ln( rand() ) ) );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = gumbel;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/gumbel/index.html b/random/base/gumbel/index.html new file mode 100644 index 000000000..e39f75f35 --- /dev/null +++ b/random/base/gumbel/index.html @@ -0,0 +1,176 @@ + + + + + + Code coverage report for random/base/gumbel/lib + + + + + + + + + +
+
+

All files random/base/gumbel/lib

+
+ +
+ 100% + Statements + 493/493 +
+ + +
+ 100% + Branches + 55/55 +
+ + +
+ 100% + Functions + 12/12 +
+ + +
+ 100% + Lines + 493/493 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
factory.js +
+
100%274/274100%44/44100%10/10100%274/274
gumbel.js +
+
100%44/44100%2/2100%1/1100%44/44
index.js +
+
100%67/67100%1/1100%0/0100%67/67
main.js +
+
100%50/50100%1/1100%0/0100%50/50
validate.js +
+
100%58/58100%7/7100%1/1100%58/58
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/gumbel/index.js.html b/random/base/gumbel/index.js.html new file mode 100644 index 000000000..4bf3ea49a --- /dev/null +++ b/random/base/gumbel/index.js.html @@ -0,0 +1,286 @@ + + + + + + Code coverage report for random/base/gumbel/lib/index.js + + + + + + + + + +
+
+

All files / random/base/gumbel/lib index.js

+
+ +
+ 100% + Statements + 67/67 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 67/67 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +681x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+/**
+* Gumbel distribution pseudorandom numbers.
+*
+* @module @stdlib/random/base/gumbel
+*
+* @example
+* var gumbel = require( '@stdlib/random/base/gumbel' );
+*
+* var v = gumbel( 0.5, 1.0 );
+* // returns <number>
+*
+* @example
+* var factory = require( '@stdlib/random/base/gumbel' ).factory;
+*
+* var gumbel = factory( 3.0, 2.0, {
+*     'seed': 297
+* });
+*
+* var v = gumbel();
+* // returns <number>
+*
+* @example
+* var factory = require( '@stdlib/random/base/gumbel' ).factory;
+*
+* var gumbel = factory({
+*     'seed': 297
+* });
+*
+* var v = gumbel( 2.0, 2.0 );
+* // returns <number>
+*/
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( main, 'factory', factory );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = main;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/gumbel/main.js.html b/random/base/gumbel/main.js.html new file mode 100644 index 000000000..222d325e7 --- /dev/null +++ b/random/base/gumbel/main.js.html @@ -0,0 +1,235 @@ + + + + + + Code coverage report for random/base/gumbel/lib/main.js + + + + + + + + + +
+
+

All files / random/base/gumbel/lib main.js

+
+ +
+ 100% + Statements + 50/50 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 50/50 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +511x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns pseudorandom number drawn from a Gumbel distribution.
+*
+* @name gumbel
+* @type {PRNG}
+* @param {number} mu - mean
+* @param {PositiveNumber} beta - scale parameter
+* @returns {number} pseudorandom number
+*
+* @example
+* var v = gumbel( 0.0, 2.0 );
+* // returns <number>
+*
+* @example
+* var v = gumbel( 0.0, -1.0 );
+* // returns NaN
+*/
+var gumbel = factory();
+ 
+ 
+// EXPORTS //
+ 
+module.exports = gumbel;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/gumbel/validate.js.html b/random/base/gumbel/validate.js.html new file mode 100644 index 000000000..d24e636dc --- /dev/null +++ b/random/base/gumbel/validate.js.html @@ -0,0 +1,259 @@ + + + + + + Code coverage report for random/base/gumbel/lib/validate.js + + + + + + + + + +
+
+

All files / random/base/gumbel/lib validate.js

+
+ +
+ 100% + Statements + 58/58 +
+ + +
+ 100% + Branches + 7/7 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 58/58 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +592x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +53x +53x +9x +9x +53x +11x +11x +33x +53x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
+var isPositive = require( '@stdlib/assert/is-positive-number' ).isPrimitive;
+var format = require( '@stdlib/string/format' );
+var isnan = require( '@stdlib/assert/is-nan' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Validates parameters.
+*
+* @private
+* @param {number} mu - mean
+* @param {PositiveNumber} beta - shape parameter
+* @returns {(Error|null)} error or null
+*
+* @example
+* var err = validate( 1.0, 2.0 );
+* if ( err ) {
+*     throw err;
+* }
+*/
+function validate( mu, beta ) {
+	if ( !isNumber( mu ) || isnan( mu ) ) {
+		return new TypeError( format( 'invalid argument. First argument must be a number and not NaN. Value: `%s`.', mu ) );
+	}
+	if ( !isPositive( beta ) ) {
+		return new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', beta ) );
+	}
+	return null;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = validate;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/poisson/coverage.ndjson b/random/base/poisson/coverage.ndjson index 4b2d963a1..2b5bf3a2c 100644 --- a/random/base/poisson/coverage.ndjson +++ b/random/base/poisson/coverage.ndjson @@ -1 +1,2 @@ [630,630,100,68,68,100,13,13,100,630,630,100,"4368c3b25edf5b315684db874ea81d1812de0adb","2024-01-11 22:04:50 -0500"] +[630,630,100,68,68,100,13,13,100,630,630,100,"42b1c7e18fadf89854f359a3a01cf37c66dd66cc","2024-01-28 21:33:01 -0500"] diff --git a/random/base/poisson/factory.js.html b/random/base/poisson/factory.js.html index 20166d36c..b2d6b8f31 100644 --- a/random/base/poisson/factory.js.html +++ b/random/base/poisson/factory.js.html @@ -895,7 +895,7 @@

All files / random