Skip to content

Commit 2b1e266

Browse files
bench: update random number generation in number/uint32/base/muldw
1 parent a081627 commit 2b1e266

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

  • lib/node_modules/@stdlib/number/uint32/base/muldw/benchmark

lib/node_modules/@stdlib/number/uint32/base/muldw/benchmark/benchmark.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var minstd = require( '@stdlib/random/base/minstd' );
24+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var format = require( '@stdlib/string/format' );
2727
var pkg = require( './../package.json' ).name;
@@ -33,12 +33,17 @@ var umuldw = require( './../lib' );
3333
bench( pkg, function benchmark( b ) {
3434
var x;
3535
var y;
36+
var z;
3637
var i;
3738

39+
x = discreteUniform( 100, 0x10000, 0x10000000, {
40+
'dtype': 'uint32'
41+
});
42+
3843
b.tic();
3944
for ( i = 0; i < b.iterations; i++ ) {
40-
x = minstd();
41-
y = umuldw( x, x );
45+
z = x[ i%x.length ];
46+
y = umuldw( z, z );
4247
if ( isnan( y[0] ) ) {
4348
b.fail( 'should not return NaN' );
4449
}
@@ -55,14 +60,19 @@ bench( format( '%s:assign', pkg ), function benchmark( b ) {
5560
var out;
5661
var x;
5762
var y;
63+
var z;
5864
var i;
5965

60-
out = [ 0.0, 0.0];
66+
x = discreteUniform( 100, 0x10000, 0x10000000, {
67+
'dtype': 'uint32'
68+
});
69+
70+
out = [ 0.0, 0.0 ];
6171

6272
b.tic();
6373
for ( i = 0; i < b.iterations; i++ ) {
64-
x = minstd();
65-
y = umuldw.assign( x, x, out, 1, 0 );
74+
z = x[ i%x.length ];
75+
y = umuldw.assign( z, z, out, 1, 0 );
6676
if ( isnan( y[0] ) ) {
6777
b.fail( 'should not return NaN' );
6878
}

0 commit comments

Comments
 (0)