-
-
Notifications
You must be signed in to change notification settings - Fork 907
bench: refactor random number generation in stats/base/dists/studentized-range
#5175
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
Changes from 1 commit
f23e1a8
41d8017
37789f8
9b817c7
7098ea1
75762e6
47ae31a
b104049
e7a3cdd
cbde69d
6bf2b4f
6678b14
204f10c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,10 @@ | |
// MODULES // | ||
|
||
var bench = require( '@stdlib/bench' ); | ||
var randu = require( '@stdlib/random/base/randu' ); | ||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var pkg = require( './../package.json' ).name; | ||
var cdf = require( './../lib' ); | ||
var uniform = require('@stdlib/random/base/uniform') | ||
|
||
|
||
// MAIN // | ||
|
@@ -36,12 +36,13 @@ bench( pkg, function benchmark( b ) { | |
var y; | ||
var i; | ||
|
||
q = uniform( 0.0, 12.0 ); | ||
r = uniform( 2.0, 20.0 ); | ||
v = uniform( 2.0, 20.0 ); | ||
|
||
y = cdf( q, r, v ); | ||
|
||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
q = randu() * 12.0; | ||
r = ( randu()*20.0 ) + 2.0; | ||
v = ( randu()*20.0 ) + 2.0; | ||
y = cdf( q, r, v ); | ||
if ( isnan( y ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
|
@@ -65,11 +66,11 @@ bench( pkg+':factory', function benchmark( b ) { | |
v = 5.0; | ||
r = 3.0; | ||
mycdf = cdf.factory( v, r ); | ||
q = uniform( 0.0, 1.0 ); | ||
y = mycdf( q ); | ||
|
||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
q = randu(); | ||
y = mycdf( q ); | ||
if ( isnan( y ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.