Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -21,8 +21,8 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var ceil = require( '@stdlib/math/base/special/ceil' );
var uniform = require( '@stdlib/random/base/uniform' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var uniform = require( '@stdlib/random/base/uniform' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var Float64Array = require( '@stdlib/array/float64' );
var uniform = require( '@stdlib/random/base/uniform' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Float64Array should be used instead of Array

var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var cdf = require( './../lib' );
Expand All @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 20.0;
n = ceil( randu()*20.0 );
x = uniform( 0.0, 20.0 );
n = discreteUniform( 1, 20 );
y = cdf( x, n );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
Expand All @@ -65,7 +65,7 @@ bench( pkg+':factory', function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 20.0;
x = uniform( 0.0, 20.0 );
y = mycdf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var ceil = require( '@stdlib/math/base/special/ceil' );
var uniform = require( '@stdlib/random/base/uniform' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var pdf = require( './../lib' );
Expand All @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 20.0;
n = ceil( randu()*20.0 );
x = uniform(0.0, 10.0);
n = discreteUniform( 1, 20 );
y = pdf( x, n );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
Expand All @@ -65,7 +65,7 @@ bench( pkg+':factory', function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 20.0;
x = uniform(0.0, 20.0);
y = mypdf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/base/uniform' );
var randint = require( '@stdlib/random/base/discrete-uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
Expand All @@ -38,7 +38,7 @@ bench( pkg, function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
p = randu();
p = uniform( 0.0, 1.0 );
n = randint( 1, 200 );
y = quantile( p, n );
if ( isnan( y ) ) {
Expand All @@ -65,7 +65,7 @@ bench( pkg+':factory', function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
p = randu();
p = uniform( 0.0, 1.0 );
y = myquantile( p );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
Expand Down
Loading