From 713a92d060a8519af4923d2d03e7e9d1f82884f4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Thu, 8 Feb 2024 03:34:10 +0000 Subject: [PATCH] Update artifacts --- random/base/cauchy/cauchy.js.html | 220 +++++++ random/base/cauchy/coverage.ndjson | 1 + random/base/cauchy/factory.js.html | 922 ++++++++++++++++++++++++++++ random/base/cauchy/index.html | 176 ++++++ random/base/cauchy/index.js.html | 256 ++++++++ random/base/cauchy/main.js.html | 235 +++++++ random/base/cauchy/validate.js.html | 259 ++++++++ random/base/t/coverage.ndjson | 1 + random/base/t/factory.js.html | 2 +- random/base/t/index.html | 2 +- random/base/t/index.js.html | 2 +- random/base/t/main.js.html | 2 +- 12 files changed, 2074 insertions(+), 4 deletions(-) create mode 100644 random/base/cauchy/cauchy.js.html create mode 100644 random/base/cauchy/coverage.ndjson create mode 100644 random/base/cauchy/factory.js.html create mode 100644 random/base/cauchy/index.html create mode 100644 random/base/cauchy/index.js.html create mode 100644 random/base/cauchy/main.js.html create mode 100644 random/base/cauchy/validate.js.html diff --git a/random/base/cauchy/cauchy.js.html b/random/base/cauchy/cauchy.js.html new file mode 100644 index 000000000..1bb247b71 --- /dev/null +++ b/random/base/cauchy/cauchy.js.html @@ -0,0 +1,220 @@ + + + + + + Code coverage report for random/base/cauchy/lib/cauchy.js + + + + + + + + + +
+
+

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

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

+ 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 +462x +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 +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 tan = require( '@stdlib/math/base/special/tan' );
+var PI = require( '@stdlib/constants/float64/pi' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a pseudorandom number drawn from a Cauchy distribution.
+*
+* @private
+* @param {PRNG} randn - PRNG for normally distributed numbers
+* @param {number} x0 - location parameter
+* @param {PositiveNumber} gamma - scale parameter
+* @returns {number} pseudorandom number
+*/
+function cauchy( randn, x0, gamma ) {
+	return x0 + ( gamma*tan( PI*( randn()-0.5 ) ) );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = cauchy;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/cauchy/coverage.ndjson b/random/base/cauchy/coverage.ndjson new file mode 100644 index 000000000..619653778 --- /dev/null +++ b/random/base/cauchy/coverage.ndjson @@ -0,0 +1 @@ +[489,489,100,55,55,100,12,12,100,489,489,100,"6008b22d8a9ccc5a5066241c4d37f9a70af7d8ae","2024-02-07 19:32:26 -0800"] diff --git a/random/base/cauchy/factory.js.html b/random/base/cauchy/factory.js.html new file mode 100644 index 000000000..d4a74ecbe --- /dev/null +++ b/random/base/cauchy/factory.js.html @@ -0,0 +1,922 @@ + + + + + + Code coverage report for random/base/cauchy/lib/factory.js + + + + + + + + + +
+
+

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

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

+ 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 +2802x +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 +132x +13x +132x +66x +66x +9x +9x +66x +19x +9x +9x +10x +10x +10x +66x +38x +38x +119x +53x +53x +53x +53x +20x +20x +53x +28x +28x +9x +9x +28x +12x +9x +9x +3x +3x +3x +28x +7x +7x +53x +5x +5x +53x +132x +25x +132x +15x +15x +40x +40x +40x +40x +40x +132x +13x +13x +13x +13x +13x +13x +132x +27x +27x +27x +27x +27x +27x +27x +40x +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 isnan = require( '@stdlib/math/base/assert/is-nan' );
+var randn = require( '@stdlib/random/base/improved-ziggurat' ).factory;
+var typedarray2json = require( '@stdlib/array/to-json' );
+var format = require( '@stdlib/string/format' );
+var validate = require( './validate.js' );
+var cauchy0 = require( './cauchy.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a pseudorandom number generator for generating random numbers from a Cauchy distribution.
+*
+* @param {number} [x0] - location parameter
+* @param {PositiveNumber} [gamma] - 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} `x0` must be a number
+* @throws {TypeError} `gamma` argument 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 cauchy = factory( 0.0, 1.0 );
+* var v = cauchy();
+* // returns <number>
+*
+* @example
+* var cauchy = factory( -3.0, 0.5, {
+*     'seed': 297
+* });
+* var v = cauchy();
+* // returns <number>
+*/
+function factory() {
+	var gamma;
+	var rnorm;
+	var opts;
+	var rand;
+	var prng;
+	var err;
+	var x0;
+ 
+	if ( arguments.length === 0 ) {
+		rnorm = randn();
+	} 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 ) );
+			}
+			rnorm = randn({
+				'prng': opts.prng
+			});
+		} else {
+			rnorm = randn( opts );
+		}
+	} else {
+		x0 = arguments[ 0 ];
+		gamma = arguments[ 1 ];
+		err = validate( x0, gamma );
+		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 ) );
+				}
+				rnorm = randn({
+					'prng': opts.prng
+				});
+			} else {
+				rnorm = randn( opts );
+			}
+		} else {
+			rnorm = randn();
+		}
+	}
+	if ( x0 === void 0 ) {
+		prng = cauchy2;
+	} else {
+		prng = cauchy1;
+	}
+	rand = rnorm.PRNG;
+ 
+	setReadOnly( prng, 'NAME', 'cauchy' );
+ 
+	// 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 ) );
+	} 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 );
+	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 ( x0 === void 0 ) {
+			out.params = [];
+		} else {
+			out.params = [ x0, gamma ];
+		}
+		return out;
+	}
+ 
+	/**
+	* Returns pseudorandom number drawn from a Cauchy distribution with bound parameters `x0` and `gamma`.
+	*
+	* @private
+	* @returns {number} pseudorandom number
+	*
+	* @example
+	* var v = cauchy1();
+	* // returns <number>
+	*/
+	function cauchy1() {
+		return cauchy0( rnorm, x0, gamma );
+	}
+ 
+	/**
+	* Returns pseudorandom number drawn from a Cauchy distribution.
+	*
+	* @private
+	* @param {number} x0 - location parameter
+	* @param {PositiveNumber} gamma - scale parameter
+	* @returns {number} pseudorandom number
+	*
+	* @example
+	* var v = cauchy2( 0.0, 2.0 );
+	* // returns <number>
+	*
+	* @example
+	* var r = cauchy2( 1.0, -1.5 );
+	* // returns NaN
+	*/
+	function cauchy2( x0, gamma ) {
+		if (
+			isnan( x0 ) ||
+			isnan( gamma ) ||
+			gamma <= 0.0
+		) {
+			return NaN;
+		}
+		return cauchy0( rnorm, x0, gamma );
+	}
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = factory;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/cauchy/index.html b/random/base/cauchy/index.html new file mode 100644 index 000000000..5279637fe --- /dev/null +++ b/random/base/cauchy/index.html @@ -0,0 +1,176 @@ + + + + + + Code coverage report for random/base/cauchy/lib + + + + + + + + + +
+
+

All files random/base/cauchy/lib

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

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

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
cauchy.js +
+
100%45/45100%2/2100%1/1100%45/45
factory.js +
+
100%279/279100%44/44100%10/10100%279/279
index.js +
+
100%57/57100%1/1100%0/0100%57/57
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/cauchy/index.js.html b/random/base/cauchy/index.js.html new file mode 100644 index 000000000..56c3ed50c --- /dev/null +++ b/random/base/cauchy/index.js.html @@ -0,0 +1,256 @@ + + + + + + Code coverage report for random/base/cauchy/lib/index.js + + + + + + + + + +
+
+

All files / random/base/cauchy/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';
+ 
+/**
+* Cauchy distribution pseudorandom numbers.
+*
+* @module @stdlib/random/base/cauchy
+*
+* @example
+* var cauchy = require( '@stdlib/random/base/cauchy' );
+*
+* var v = cauchy( 0.5, 1.0 );
+* // returns <number>
+*
+* @example
+* var factory = require( '@stdlib/random/base/cauchy' ).factory;
+*
+* var cauchy = factory( 3.0, 2.0, {
+*     'seed': 297
+* });
+*
+* var v = cauchy();
+* // 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/cauchy/main.js.html b/random/base/cauchy/main.js.html new file mode 100644 index 000000000..105baf88e --- /dev/null +++ b/random/base/cauchy/main.js.html @@ -0,0 +1,235 @@ + + + + + + Code coverage report for random/base/cauchy/lib/main.js + + + + + + + + + +
+
+

All files / random/base/cauchy/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 Cauchy distribution.
+*
+* @name cauchy
+* @type {PRNG}
+* @param {number} x0 - location parameter
+* @param {PositiveNumber} gamma - scale parameter
+* @returns {number} pseudorandom number
+*
+* @example
+* var v = cauchy( 0.0, 2.0 );
+* // returns <number>
+*
+* @example
+* var v = cauchy( 0.0, -1.0 );
+* // returns NaN
+*/
+var cauchy = factory();
+ 
+ 
+// EXPORTS //
+ 
+module.exports = cauchy;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/cauchy/validate.js.html b/random/base/cauchy/validate.js.html new file mode 100644 index 000000000..44cd671b8 --- /dev/null +++ b/random/base/cauchy/validate.js.html @@ -0,0 +1,259 @@ + + + + + + Code coverage report for random/base/cauchy/lib/validate.js + + + + + + + + + +
+
+

All files / random/base/cauchy/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} x0 - location parameter
+* @param {PositiveNumber} gamma - scale parameter
+* @returns {(Error|null)} error or null
+*
+* @example
+* var err = validate( 1.0, 2.5 );
+* if ( err ) {
+*     throw err;
+* }
+*/
+function validate( x0, gamma ) {
+	if ( !isNumber( x0 ) || isnan( x0 ) ) {
+		return new TypeError( format( 'invalid argument. First argument must be a number and not NaN. Value: `%s`.', x0 ) );
+	}
+	if ( !isPositive( gamma ) ) {
+		return new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', gamma ) );
+	}
+	return null;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = validate;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/random/base/t/coverage.ndjson b/random/base/t/coverage.ndjson index 4bbb62aae..097627d10 100644 --- a/random/base/t/coverage.ndjson +++ b/random/base/t/coverage.ndjson @@ -1 +1,2 @@ [478,478,100,77,77,100,10,10,100,478,478,100,"4368c3b25edf5b315684db874ea81d1812de0adb","2024-01-11 22:04:50 -0500"] +[478,478,100,77,77,100,10,10,100,478,478,100,"6008b22d8a9ccc5a5066241c4d37f9a70af7d8ae","2024-02-07 19:32:26 -0800"] diff --git a/random/base/t/factory.js.html b/random/base/t/factory.js.html index 20383f2dd..180957b41 100644 --- a/random/base/t/factory.js.html +++ b/random/base/t/factory.js.html @@ -1150,7 +1150,7 @@

All files / random