diff --git a/lib/node_modules/@stdlib/constants/float32/ninf/lib/index.js b/lib/node_modules/@stdlib/constants/float32/ninf/lib/index.js index 724b622afa4b..a2d6403dcee0 100644 --- a/lib/node_modules/@stdlib/constants/float32/ninf/lib/index.js +++ b/lib/node_modules/@stdlib/constants/float32/ninf/lib/index.js @@ -26,7 +26,7 @@ * * @example * var FLOAT32_NINF = require( '@stdlib/constants/float32/ninf' ); -* // returns -infinity +* // returns -Infinity */ // MODULES // diff --git a/lib/node_modules/@stdlib/random/sample/lib/renormalizing.js b/lib/node_modules/@stdlib/random/sample/lib/renormalizing.js index eb09a5f8ec96..7e8b038eca03 100644 --- a/lib/node_modules/@stdlib/random/sample/lib/renormalizing.js +++ b/lib/node_modules/@stdlib/random/sample/lib/renormalizing.js @@ -18,6 +18,13 @@ 'use strict'; +// MODULES // + +var copy = require( '@stdlib/array/base/copy' ); + + +// MAIN // + /** * Samples without replacement from a discrete set using custom probabilities. * @@ -43,11 +50,9 @@ function renormalizing( x, size, rand, probabilities ) { var u; N = x.length; - probs = new Array( N ); - for ( i = 0; i < N; i++ ) { - probs[ i ] = probabilities[ i ]; - } - out = new Array( size ); + probs = copy( probabilities ); + + out = []; for ( i = 0; i < size; i++ ) { u = rand(); psum = 0; @@ -64,7 +69,7 @@ function renormalizing( x, size, rand, probabilities ) { probs[ k ] /= 1.0 - probs[ j ]; } probs[ j ] = 0.0; - out[ i ] = x[ j ]; + out.push( x[ j ] ); } return out; }