Skip to content

Commit eb1c31b

Browse files
authored
bench: avoid calling PRNG within loop
Signed-off-by: Athan <kgryte@gmail.com>
1 parent c7ea9d4 commit eb1c31b

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/node_modules/@stdlib/assert/contains/benchmark/benchmark.length.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
var bench = require( '@stdlib/bench' );
2424
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2525
var pow = require( '@stdlib/math/base/special/pow' );
26-
var randu = require( '@stdlib/random/base/randu' );
2726
var format = require( '@stdlib/string/format' );
2827
var pkg = require( './../package.json' ).name;
2928
var contains = require( './../lib' );
@@ -62,7 +61,7 @@ function createBenchmark( fcn, len ) {
6261
b.tic();
6362
for ( i = 0; i < b.iterations; i++ ) {
6463
// Note: we are testing the worst case scenario where a function must scan the entire array before finding a value.
65-
x[ len-2 ] = randu();
64+
x[ len-2 ] -= 1;
6665
bool = fcn( x, len-1 );
6766
if ( typeof bool !== 'boolean' ) {
6867
b.fail( 'should return a boolean' );

0 commit comments

Comments
 (0)