Skip to content

Commit 1108384

Browse files
committed
Auto-generated commit
1 parent 04e1a3f commit 1108384

5 files changed

Lines changed: 425 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ A total of 10 issues were closed in this release:
168168

169169
<details>
170170

171+
- [`4574e32`](https://github.com/stdlib-js/stdlib/commit/4574e3216991a30ec46d3b4a2d5e9d84e31da20e) - **bench:** add factory benchmarks to `random/base` PRNGs [(#11563)](https://github.com/stdlib-js/stdlib/pull/11563) _(by Philipp Burckhardt)_
171172
- [`70acfd3`](https://github.com/stdlib-js/stdlib/commit/70acfd35f5774575e1e42361608ec20328f23c4b) - **bench:** refactor to use string interpolation in `@stdlib/random` [(#11427)](https://github.com/stdlib-js/stdlib/pull/11427) _(by Karan Anand)_
172173
- [`49fc241`](https://github.com/stdlib-js/stdlib/commit/49fc2415618fdc746ce1bb16654e5d291fb6db85) - **docs:** fix `options.seed` duplicate and add missing `options.copy` tags in `random/iter` [(#11558)](https://github.com/stdlib-js/stdlib/pull/11558) _(by Philipp Burckhardt)_
173174
- [`fddbb92`](https://github.com/stdlib-js/stdlib/commit/fddbb92925b8417c846356548ace38c51674a318) - **bench:** refactor to use string interpolation in `@stdlib/random/iter` [(#11424)](https://github.com/stdlib-js/stdlib/pull/11424) _(by Karan Anand)_
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var Uint32Array = require( '@stdlib/array/uint32' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var minstd = require( './../../../base/minstd-shuffle' );
27+
var format = require( '@stdlib/string/format' );
28+
var pkg = require( './../package.json' ).name;
29+
var factory = require( './../lib' ).factory;
30+
31+
32+
// MAIN //
33+
34+
bench( format( '%s:factory', pkg ), function benchmark( b ) {
35+
var f;
36+
var i;
37+
38+
b.tic();
39+
for ( i = 0; i < b.iterations; i++ ) {
40+
f = factory();
41+
if ( typeof f !== 'function' ) {
42+
b.fail( 'should return a function' );
43+
}
44+
}
45+
b.toc();
46+
if ( isnan( f( 2.0, 2.0 ) ) ) {
47+
b.fail( 'should not return NaN' );
48+
}
49+
b.pass( 'benchmark finished' );
50+
b.end();
51+
});
52+
53+
bench( format( '%s:factory:seed=<integer>', pkg ), function benchmark( b ) {
54+
var opts;
55+
var f;
56+
var i;
57+
58+
opts = {
59+
'seed': 1
60+
};
61+
62+
b.tic();
63+
for ( i = 0; i < b.iterations; i++ ) {
64+
opts.seed += i;
65+
f = factory( opts );
66+
if ( typeof f !== 'function' ) {
67+
b.fail( 'should return a function' );
68+
}
69+
}
70+
b.toc();
71+
if ( isnan( f( 2.0, 2.0 ) ) ) {
72+
b.fail( 'should not return NaN' );
73+
}
74+
b.pass( 'benchmark finished' );
75+
b.end();
76+
});
77+
78+
bench( format( '%s:factory:seed=<array>', pkg ), function benchmark( b ) {
79+
var seed;
80+
var opts;
81+
var f;
82+
var i;
83+
84+
opts = {};
85+
86+
seed = new Uint32Array( 10 );
87+
for ( i = 0; i < seed.length; i++ ) {
88+
seed[ i ] = minstd();
89+
}
90+
opts.seed = seed;
91+
92+
b.tic();
93+
for ( i = 0; i < b.iterations; i++ ) {
94+
opts.seed[ 0 ] = i + 1;
95+
f = factory( opts );
96+
if ( typeof f !== 'function' ) {
97+
b.fail( 'should return a function' );
98+
}
99+
}
100+
b.toc();
101+
if ( isnan( f( 2.0, 2.0 ) ) ) {
102+
b.fail( 'should not return NaN' );
103+
}
104+
b.pass( 'benchmark finished' );
105+
b.end();
106+
});
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var Uint32Array = require( '@stdlib/array/uint32' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var minstd = require( './../../../base/minstd-shuffle' );
27+
var format = require( '@stdlib/string/format' );
28+
var pkg = require( './../package.json' ).name;
29+
var factory = require( './../lib' ).factory;
30+
31+
32+
// MAIN //
33+
34+
bench( format( '%s:factory', pkg ), function benchmark( b ) {
35+
var f;
36+
var i;
37+
38+
b.tic();
39+
for ( i = 0; i < b.iterations; i++ ) {
40+
f = factory();
41+
if ( typeof f !== 'function' ) {
42+
b.fail( 'should return a function' );
43+
}
44+
}
45+
b.toc();
46+
if ( isnan( f() ) ) {
47+
b.fail( 'should not return NaN' );
48+
}
49+
b.pass( 'benchmark finished' );
50+
b.end();
51+
});
52+
53+
bench( format( '%s:factory:seed=<integer>', pkg ), function benchmark( b ) {
54+
var opts;
55+
var f;
56+
var i;
57+
58+
opts = {
59+
'seed': 1
60+
};
61+
62+
b.tic();
63+
for ( i = 0; i < b.iterations; i++ ) {
64+
opts.seed += i;
65+
f = factory( opts );
66+
if ( typeof f !== 'function' ) {
67+
b.fail( 'should return a function' );
68+
}
69+
}
70+
b.toc();
71+
if ( isnan( f() ) ) {
72+
b.fail( 'should not return NaN' );
73+
}
74+
b.pass( 'benchmark finished' );
75+
b.end();
76+
});
77+
78+
bench( format( '%s:factory:seed=<array>', pkg ), function benchmark( b ) {
79+
var seed;
80+
var opts;
81+
var f;
82+
var i;
83+
84+
opts = {};
85+
86+
seed = new Uint32Array( 10 );
87+
for ( i = 0; i < seed.length; i++ ) {
88+
seed[ i ] = minstd();
89+
}
90+
opts.seed = seed;
91+
92+
b.tic();
93+
for ( i = 0; i < b.iterations; i++ ) {
94+
opts.seed[ 0 ] = i + 1;
95+
f = factory( opts );
96+
if ( typeof f !== 'function' ) {
97+
b.fail( 'should return a function' );
98+
}
99+
}
100+
b.toc();
101+
if ( isnan( f() ) ) {
102+
b.fail( 'should not return NaN' );
103+
}
104+
b.pass( 'benchmark finished' );
105+
b.end();
106+
});
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var Uint32Array = require( '@stdlib/array/uint32' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var minstd = require( './../../../base/minstd-shuffle' );
27+
var format = require( '@stdlib/string/format' );
28+
var pkg = require( './../package.json' ).name;
29+
var factory = require( './../lib' ).factory;
30+
31+
32+
// MAIN //
33+
34+
bench( format( '%s:factory', pkg ), function benchmark( b ) {
35+
var f;
36+
var i;
37+
38+
b.tic();
39+
for ( i = 0; i < b.iterations; i++ ) {
40+
f = factory();
41+
if ( typeof f !== 'function' ) {
42+
b.fail( 'should return a function' );
43+
}
44+
}
45+
b.toc();
46+
if ( isnan( f() ) ) {
47+
b.fail( 'should not return NaN' );
48+
}
49+
b.pass( 'benchmark finished' );
50+
b.end();
51+
});
52+
53+
bench( format( '%s:factory:seed=<integer>', pkg ), function benchmark( b ) {
54+
var opts;
55+
var f;
56+
var i;
57+
58+
opts = {
59+
'seed': 1
60+
};
61+
62+
b.tic();
63+
for ( i = 0; i < b.iterations; i++ ) {
64+
opts.seed += i;
65+
f = factory( opts );
66+
if ( typeof f !== 'function' ) {
67+
b.fail( 'should return a function' );
68+
}
69+
}
70+
b.toc();
71+
if ( isnan( f() ) ) {
72+
b.fail( 'should not return NaN' );
73+
}
74+
b.pass( 'benchmark finished' );
75+
b.end();
76+
});
77+
78+
bench( format( '%s:factory:seed=<array>', pkg ), function benchmark( b ) {
79+
var seed;
80+
var opts;
81+
var f;
82+
var i;
83+
84+
opts = {};
85+
86+
seed = new Uint32Array( 10 );
87+
for ( i = 0; i < seed.length; i++ ) {
88+
seed[ i ] = minstd();
89+
}
90+
opts.seed = seed;
91+
92+
b.tic();
93+
for ( i = 0; i < b.iterations; i++ ) {
94+
opts.seed[ 0 ] = i + 1;
95+
f = factory( opts );
96+
if ( typeof f !== 'function' ) {
97+
b.fail( 'should return a function' );
98+
}
99+
}
100+
b.toc();
101+
if ( isnan( f() ) ) {
102+
b.fail( 'should not return NaN' );
103+
}
104+
b.pass( 'benchmark finished' );
105+
b.end();
106+
});

0 commit comments

Comments
 (0)