Skip to content

bench: refactor number generation #5212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ for ( i = 0; i < 10; i++ ) {

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

<!-- C interface documentation. -->

* * *
Expand Down Expand Up @@ -162,7 +158,7 @@ for ( i = 0; i < 10; i++ ) {

#### stdlib_base_dists_exponential_cdf( x, lambda )

Evaluates the [probability density function][cdf] (cdf) for an [exponential][exponential-distribution] distribution with rate parameter `lambda`.
Evaluates the [cumulative distribution function][cdf] (cdf) for an [exponential][exponential-distribution] distribution with rate parameter `lambda`.

```c
double out = stdlib_base_dists_exponential_cdf( 2.0, 0.7 );
Expand Down Expand Up @@ -226,6 +222,12 @@ int main( void ) {

<!-- /.references -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/base/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var tryRequire = require( '@stdlib/utils/try-require' );
Expand Down Expand Up @@ -51,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
x = new Float64Array( len );
lambda = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( randu()*100.0 );
lambda[ i ] = ( randu()*100.0 ) + EPS;
x[ i ] = uniform( 0.0, 100.0 );
lambda[ i ] = uniform( EPS, 100.0 );
}

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static double benchmark( void ) {

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
y = stdlib_base_dists_exponential_cdf( x[ i % 100 ], lambda[ i % 100 ]);
y = stdlib_base_dists_exponential_cdf( x[ i % 100 ], lambda[ i % 100 ] );
if ( y != y ) {
printf( "should not return NaN\n" );
break;
Expand Down