stdlib-js / random-base-mt19937
Showing 1 of 3 files from the diff.
Other files ignored by Codecov
package.json has changed.

@@ -75,6 +75,7 @@
Loading
75 75
var umul = require( '@stdlib/math-base-ops-umul' );
76 76
var gcopy = require( '@stdlib/blas-base-gcopy' );
77 77
var typedarray2json = require( '@stdlib/array-to-json' );
78 +
var format = require( '@stdlib/string-format' );
78 79
var randuint32 = require( './rand_uint32.js' );
79 80
80 81
@@ -172,15 +173,15 @@
Loading
172 173
	}
173 174
	// The state array must have a minimum length...
174 175
	if ( state.length < STATE_FIXED_LENGTH+1 ) {
175 -
		return new RangeError( 'invalid '+s1+'. `state` array has insufficient length.' );
176 +
		return new RangeError( format( 'invalid %s. `state` array has insufficient length.', s1 ) );
176 177
	}
177 178
	// The first element of the state array must equal the supported state array schema version...
178 179
	if ( state[ 0 ] !== STATE_ARRAY_VERSION ) {
179 -
		return new RangeError( 'invalid '+s1+'. `state` array has an incompatible schema version. Expected: '+STATE_ARRAY_VERSION+'. Actual: '+state[ 0 ]+'.' );
180 +
		return new RangeError( format( 'invalid %s. `state` array has an incompatible schema version. Expected: %s. Actual: %s.' , s1, STATE_ARRAY_VERSION, state[ 0 ] ) );
180 181
	}
181 182
	// The second element of the state array must contain the number of sections...
182 183
	if ( state[ 1 ] !== NUM_STATE_SECTIONS ) {
183 -
		return new RangeError( 'invalid '+s1+'. `state` array has an incompatible number of sections. Expected: '+NUM_STATE_SECTIONS+'. Actual: '+state[ 1 ]+'.' );
184 +
		return new RangeError( format( 'invalid %s. `state` array has an incompatible number of sections. Expected: %s. Actual: %s.', s1, NUM_STATE_SECTIONS, state[ 1 ] ) );
184 185
	}
185 186
	// The length of the "state" section must equal `N`...
186 187
	if ( state[ STATE_SECTION_OFFSET ] !== N ) {
@@ -376,19 +377,19 @@
Loading
376 377
	opts = {};
377 378
	if ( arguments.length ) {
378 379
		if ( !isObject( options ) ) {
379 -
			throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
380 +
			throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
380 381
		}
381 382
		if ( hasOwnProp( options, 'copy' ) ) {
382 383
			opts.copy = options.copy;
383 384
			if ( !isBoolean( options.copy ) ) {
384 -
				throw new TypeError( 'invalid option. `copy` option must be a boolean. Option: `' + options.copy + '`.' );
385 +
				throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', options.copy ) );
385 386
			}
386 387
		}
387 388
		if ( hasOwnProp( options, 'state' ) ) {
388 389
			state = options.state;
389 390
			opts.state = true;
390 391
			if ( !isUint32Array( state ) ) {
391 -
				throw new TypeError( 'invalid option. `state` option must be a Uint32Array. Option: `' + state + '`.' );
392 +
				throw new TypeError( format( 'invalid option. `%s` option must be a Uint32Array. Option: `%s`.', 'state', state ) );
392 393
			}
393 394
			err = verifyState( state, true );
394 395
			if ( err ) {
@@ -413,18 +414,18 @@
Loading
413 414
				opts.seed = true;
414 415
				if ( isPositiveInteger( seed ) ) {
415 416
					if ( seed > MAX_SEED ) {
416 -
						throw new RangeError( 'invalid option. `seed` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `' + seed + '`.' );
417 +
						throw new RangeError( format( 'invalid option. `seed` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.', seed ) );
417 418
					}
418 419
					seed >>>= 0; // asm type annotation
419 420
				} else if ( isCollection( seed ) === false || seed.length < 1 ) {
420 -
					throw new TypeError( 'invalid option. `seed` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `' + seed + '`.' );
421 +
					throw new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', seed ) );
421 422
				} else if ( seed.length === 1 ) {
422 423
					seed = seed[ 0 ];
423 424
					if ( !isPositiveInteger( seed ) ) {
424 -
						throw new TypeError( 'invalid option. `seed` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `' + seed + '`.' );
425 +
						throw new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', seed ) );
425 426
					}
426 427
					if ( seed > MAX_SEED ) {
427 -
						throw new RangeError( 'invalid option. `seed` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `' + seed + '`.' );
428 +
						throw new RangeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.', 'seed', seed ) );
428 429
					}
429 430
					seed >>>= 0; // asm type annotation
430 431
				} else {
@@ -587,7 +588,7 @@
Loading
587 588
	function setState( s ) {
588 589
		var err;
589 590
		if ( !isUint32Array( s ) ) {
590 -
			throw new TypeError( 'invalid argument. Must provide a Uint32Array. Value: `' + s + '`.' );
591 +
			throw new TypeError( format( 'invalid argument. Must provide a Uint32Array. Value: `%s`.', s ) );
591 592
		}
592 593
		err = verifyState( s, false );
593 594
		if ( err ) {
Files Coverage
lib 100.00%
Project Totals (4 files) 100.00%
2043510619
unittests
2024999047
unittests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading