Skip to content

Commit 1389ab8

Browse files
committed
Auto-generated commit
1 parent 9ec39e0 commit 1389ab8

File tree

9 files changed

+65
-28
lines changed

9 files changed

+65
-28
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-03-17)
7+
## Unreleased (2025-04-15)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`da87aba`](https://github.com/stdlib-js/stdlib/commit/da87aba5a4cbb2ff6553a2d9d0ee6eb83bcdc8da) - **bench:** update random value generation [(#6690)](https://github.com/stdlib-js/stdlib/pull/6690) _(by Harsh)_
1516
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_
1617

1718
</details>
@@ -24,9 +25,10 @@
2425

2526
### Contributors
2627

27-
A total of 1 person contributed to this release. Thank you to this contributor:
28+
A total of 2 people contributed to this release. Thank you to the following contributors:
2829

2930
- Athan Reines
31+
- Harsh
3032

3133
</section>
3234

CONTRIBUTORS

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# Contributors listed in alphabetical order.
44

55
Aadish Jain <jain.aadishj@gmail.com>
6+
Aarya Balwadkar <142713127+AaryaBalwadkar@users.noreply.github.com>
67
Aayush Khanna <aayushiitbhu23@gmail.com>
78
Abdelrahman Samir <60700731+abdelrahman04@users.noreply.github.com>
9+
Abdul Kaium <97376242+impawstarlight@users.noreply.github.com>
810
Abhay Punia <156515195+Hecker165@users.noreply.github.com>
911
Abhijit Raut <abhijitmraut8010@gmail.com>
1012
Abhishek Jain <40913033+abhishekblue@users.noreply.github.com>
@@ -16,6 +18,7 @@ Ahmed Khaled <kahmd1444@gmail.com>
1618
Aksshay Balasubramanian <119944779+Aksshay88@users.noreply.github.com>
1719
Aleksandr <112382387+alextes90@users.noreply.github.com>
1820
Ali Salesi <ali_sal1381@yahoo.com>
21+
AlyAbdelmoneim <148393799+AlyAbdelmoneim@users.noreply.github.com>
1922
Aman Bhansali <bhansali.1@iitj.ac.in>
2023
AmanBhadkariya <140033975+AmanBhadkariya@users.noreply.github.com>
2124
Amit Jimiwal <amitjimiwal45@gmail.com>
@@ -24,6 +27,7 @@ Anshu Kumar <contact.anshukumar@protonmail.com>
2427
Anudeep Sanapala <anudeep0306@gmail.com>
2528
Athan Reines <kgryte@gmail.com>
2629
Ayaka <73595362+USERSATOSHI@users.noreply.github.com>
30+
Bhavishy Agrawal <90029607+bhavishy2801@users.noreply.github.com>
2731
Brendan Graetz <bguiz@users.noreply.github.com>
2832
Bruno Fenzl <brunofenzl@gmail.com>
2933
Bryan Elee <rxbryn@gmail.com>
@@ -39,13 +43,15 @@ Dev Goel <135586571+corsairier@users.noreply.github.com>
3943
Dhanyabad behera <110620935+dhanyabad11@users.noreply.github.com>
4044
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
4145
Dhruvil Mehta <68022411+dhruvilmehta@users.noreply.github.com>
46+
Dipjyoti Das <126075231+dipexplorer@users.noreply.github.com>
4247
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
4348
Dominic Lim <46486515+domlimm@users.noreply.github.com>
4449
Dominik Moritz <domoritz@gmail.com>
4550
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
4651
EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
4752
Frank Kovacs <fran70kk@gmail.com>
4853
GK Bishnoi <gkishan1kyt@gmail.com>
54+
GURU PRASAD SHARMA <168292003+GURUPRASADSHARMA@users.noreply.github.com>
4955
Gaurav <gaurav70380@gmail.com>
5056
Gautam sharma <gautamkrishnasharma1@gmail.com>
5157
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
@@ -61,6 +67,7 @@ Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
6167
Jaison D Souza <123267719+jsndz@users.noreply.github.com>
6268
Jalaj Kumar <142599224+jalajk3004@users.noreply.github.com>
6369
James Gelok <jdgelok@gmail.com>
70+
Jay Soni <jaygsoni14@gmail.com>
6471
Jaysukh Makvana <jaysukhmakvana2004@gmail.com>
6572
Jenish Thapa <141203631+jenish-thapa@users.noreply.github.com>
6673
Jithin KS <jithinks112@gmail.com>
@@ -70,14 +77,18 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
7077
Joris Labie <joris.labie1@gmail.com>
7178
Justin Dennison <justin1dennison@gmail.com>
7279
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
73-
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
80+
Karan Anand <anandkarancompsci@gmail.com>
81+
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
7482
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
7583
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
84+
Kavyansh-Bagdi <153486713+Kavyansh-Bagdi@users.noreply.github.com>
7685
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
7786
Krishnam Agarwal <83017176+888krishnam@users.noreply.github.com>
7887
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
7988
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
8089
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
90+
MANI <77221000+Eternity0207@users.noreply.github.com>
91+
Mahfuza Humayra Mohona <mhmohona@gmail.com>
8192
Manik Sharma <maniksharma.rke@gmail.com>
8293
Manvith M <148960168+manvith2003@users.noreply.github.com>
8394
Marcus Fantham <mfantham@users.noreply.github.com>
@@ -88,9 +99,12 @@ Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com>
8899
Mohammad Kaif <mdkaifprofession@gmail.com>
89100
Momtchil Momtchev <momtchil@momtchev.com>
90101
Muhammad Haris <harriskhan047@outlook.com>
102+
Muhammad Taaha Tariq <166188821+Taaha-Tariq@users.noreply.github.com>
103+
Muhmmad Saad <106260977+saad-imran-dev@users.noreply.github.com>
91104
Naresh Jagadeesan <naresh.naresh000@gmail.com>
92105
Naveen Kumar <stupiddint@gmail.com>
93106
Neeraj Pathak <neerajrpathak710@gmail.com>
107+
NirvedMishra <139633597+NirvedMishra@users.noreply.github.com>
94108
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
95109
Nishchay Rajput <121144841+NishchayRajput@users.noreply.github.com>
96110
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
@@ -99,15 +113,20 @@ Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
99113
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
100114
Ori Miles <97595296+orimiles5@users.noreply.github.com>
101115
Philipp Burckhardt <pburckhardt@outlook.com>
116+
Prajjwal Bajpai <142303989+prajjwalbajpai@users.noreply.github.com>
102117
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
103118
Pranav Goswami <pranavchiku11@gmail.com>
104119
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
105120
Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
121+
PrathamBhamare <164445568+PrathamBhamare@users.noreply.github.com>
106122
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
107123
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
124+
Pravesh Kunwar <praveshkunwar04@gmail.com>
108125
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
109126
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
127+
Pulkit Gupta <65711278+pulkitgupta2@users.noreply.github.com>
110128
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
129+
Rahul Kumar <132570066+rahulptl165@users.noreply.github.com>
111130
Raunak Kumar Gupta <raunakmodanwal321@gmail.com>
112131
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
113132
Ricky Reusser <rsreusser@gmail.com>
@@ -116,12 +135,17 @@ Rishav <115060907+rishav2404@users.noreply.github.com>
116135
Rishav Tarway <rishavtarway@gmail.com>
117136
Robert Gislason <gztown2216@yahoo.com>
118137
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
138+
Rupa <102663541+Rupa-Rd@users.noreply.github.com>
119139
Rutam Kathale <138517416+performant23@users.noreply.github.com>
120140
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
121141
Ryan Seal <splrk@users.noreply.github.com>
122142
Rylan Yang <137365285+rylany27@users.noreply.github.com>
143+
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
123144
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
145+
Sahil Goyal <87982509+sahil20021008@users.noreply.github.com>
146+
Sai Avinash <120403424+nasarobot@users.noreply.github.com>
124147
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
148+
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>
125149
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
126150
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
127151
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
@@ -157,6 +181,7 @@ Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
157181
ditsu <170345142+ditsus@users.noreply.github.com>
158182
ekambains <bainsinbusiness@gmail.com>
159183
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
184+
lohithganni <116790357+lohithganni@users.noreply.github.com>
160185
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
161186
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
162187
rahulrangers <127782777+rahulrangers@users.noreply.github.com>

benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
25-
var round = require( '@stdlib/math-base-special-round' );
24+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
2625
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2726
var pkg = require( './../package.json' ).name;
2827
var isPositiveInteger = require( './../lib' );
@@ -31,14 +30,19 @@ var isPositiveInteger = require( './../lib' );
3130
// MAIN //
3231

3332
bench( pkg, function benchmark( b ) {
33+
var opts;
3434
var x;
3535
var y;
3636
var i;
3737

38+
opts = {
39+
'dtype': 'float64'
40+
};
41+
x = discreteUniform( 100, -5.0e6, 5.0e6, opts );
42+
3843
b.tic();
3944
for ( i = 0; i < b.iterations; i++ ) {
40-
x = round( (randu()*1.0e7) - 5.0e6 );
41-
y = isPositiveInteger( x );
45+
y = isPositiveInteger( x[ i%x.length ] );
4246
if ( typeof y !== 'boolean' ) {
4347
b.fail( 'should return a boolean' );
4448
}

benchmark/benchmark.native.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var randu = require( '@stdlib/random-base-randu' );
26-
var round = require( '@stdlib/math-base-special-round' );
25+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
2726
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2827
var tryRequire = require( '@stdlib/utils-try-require' );
2928
var pkg = require( './../package.json' ).name;
@@ -40,14 +39,19 @@ var opts = {
4039
// MAIN //
4140

4241
bench( pkg+'::native', opts, function benchmark( b ) {
42+
var opts;
4343
var x;
4444
var y;
4545
var i;
4646

47+
opts = {
48+
'dtype': 'float64'
49+
};
50+
x = discreteUniform( 100, -5.0e6, 5.0e6, opts );
51+
4752
b.tic();
4853
for ( i = 0; i < b.iterations; i++ ) {
49-
x = round( (randu()*1.0e7 ) - 5.0e6 );
50-
y = isPositiveInteger( x );
54+
y = isPositiveInteger( x[ i%x.length ] );
5155
if ( typeof y !== 'boolean' ) {
5256
b.fail( 'should return a boolean' );
5357
}

benchmark/c/native/benchmark.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,18 @@ static double rand_double( void ) {
9292
*/
9393
static double benchmark( void ) {
9494
double elapsed;
95-
double x;
95+
double x[ 100 ];
9696
double t;
9797
bool b;
9898
int i;
9999

100+
for ( i = 0; i < 100; i++ ) {
101+
x[ i ] = ( rand_double() * 200.0 ) - 100.0;
102+
}
103+
100104
t = tic();
101105
for ( i = 0; i < ITERATIONS; i++ ) {
102-
x = ( rand_double() * 200.0 ) - 100.0;
103-
b = stdlib_base_is_positive_integer( x );
106+
b = stdlib_base_is_positive_integer( x[ i%100 ] );
104107
if ( b != true && b != false ) {
105108
printf( "should return either true or false\n" );
106109
break;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"@stdlib/boolean-ctor": "^0.2.2",
4949
"@stdlib/constants-float64-ninf": "^0.2.2",
5050
"@stdlib/constants-float64-pinf": "^0.2.2",
51-
"@stdlib/math-base-special-round": "^0.3.0",
5251
"@stdlib/math-base-special-trunc": "^0.2.2",
52+
"@stdlib/random-array-discrete-uniform": "^0.2.1",
5353
"@stdlib/random-base-randu": "^0.2.1",
5454
"@stdlib/utils-try-require": "^0.2.2",
5555
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

test/test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ tape( 'main export is a function', function test( t ) {
3939
tape( 'the function returns `true` if provided a positive integer', function test( t ) {
4040
var i;
4141
for ( i = 1; i < 101; i++ ) {
42-
t.equal( isPositiveInteger( i ), true, 'returns true when provided '+i );
42+
t.equal( isPositiveInteger( i ), true, 'returns expected value when provided '+i );
4343
}
4444
t.end();
4545
});
4646

4747
tape( 'the function returns `false` if not provided a positive integer', function test( t ) {
4848
var i;
4949
for ( i = 0; i > -101; i-- ) {
50-
t.equal( isPositiveInteger( i ), false, 'returns false when provided '+i );
50+
t.equal( isPositiveInteger( i ), false, 'returns expected value when provided '+i );
5151
}
5252
t.end();
5353
});
@@ -58,23 +58,23 @@ tape( 'the function returns `false` if not provided an integer', function test(
5858
for ( i = 0; i < 100; i++ ) {
5959
v = ( randu()*100.0 ) - 50.0;
6060
if ( trunc(v) !== v ) {
61-
t.equal( isPositiveInteger( v ), false, 'returns false when provided '+v );
61+
t.equal( isPositiveInteger( v ), false, 'returns expected value when provided '+v );
6262
}
6363
}
6464
t.end();
6565
});
6666

6767
tape( 'the function returns `false` if provided `NaN`', function test( t ) {
68-
t.equal( isPositiveInteger( NaN ), false, 'returns false' );
68+
t.equal( isPositiveInteger( NaN ), false, 'returns expected value' );
6969
t.end();
7070
});
7171

7272
tape( 'WARNING: the function returns `true` if provided `+infinity`', function test( t ) {
73-
t.equal( isPositiveInteger( PINF ), true, 'returns true' );
73+
t.equal( isPositiveInteger( PINF ), true, 'returns expected value' );
7474
t.end();
7575
});
7676

7777
tape( 'the function returns `false` if provided `-infinity`', function test( t ) {
78-
t.equal( isPositiveInteger( NINF ), false, 'returns false' );
78+
t.equal( isPositiveInteger( NINF ), false, 'returns expected value' );
7979
t.end();
8080
});

test/test.native.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ tape( 'main export is a function', opts, function test( t ) {
4848
tape( 'the function returns `true` if provided a positive integer', opts, function test( t ) {
4949
var i;
5050
for ( i = 1; i < 101; i++ ) {
51-
t.equal( isPositiveInteger( i ), true, 'returns true when provided '+i );
51+
t.equal( isPositiveInteger( i ), true, 'returns expected value when provided '+i );
5252
}
5353
t.end();
5454
});
5555

5656
tape( 'the function returns `false` if not provided a positive integer', opts, function test( t ) {
5757
var i;
5858
for ( i = 0; i > -101; i-- ) {
59-
t.equal( isPositiveInteger( i ), false, 'returns false when provided '+i );
59+
t.equal( isPositiveInteger( i ), false, 'returns expected value when provided '+i );
6060
}
6161
t.end();
6262
});
@@ -67,23 +67,23 @@ tape( 'the function returns `false` if not provided an integer', opts, function
6767
for ( i = 0; i < 100; i++ ) {
6868
v = ( randu() * 100.0 ) - 50.0;
6969
if ( trunc(v) !== v ) {
70-
t.equal( isPositiveInteger( v ), false, 'returns false when provided '+v );
70+
t.equal( isPositiveInteger( v ), false, 'returns expected value when provided '+v );
7171
}
7272
}
7373
t.end();
7474
});
7575

7676
tape( 'the function returns `false` if provided `NaN`', opts, function test( t ) {
77-
t.equal( isPositiveInteger( NaN ), false, 'returns false' );
77+
t.equal( isPositiveInteger( NaN ), false, 'returns expected value' );
7878
t.end();
7979
});
8080

8181
tape( 'WARNING: the function returns `true` if provided `+infinity`', opts, function test( t ) {
82-
t.equal( isPositiveInteger( PINF ), true, 'returns true' );
82+
t.equal( isPositiveInteger( PINF ), true, 'returns expected value' );
8383
t.end();
8484
});
8585

8686
tape( 'the function returns `false` if provided `-infinity`', opts, function test( t ) {
87-
t.equal( isPositiveInteger( NINF ), false, 'returns false' );
87+
t.equal( isPositiveInteger( NINF ), false, 'returns expected value' );
8888
t.end();
8989
});

0 commit comments

Comments
 (0)