<commit_before><commit_msg>Add benchmarks<commit_after>'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/math/base/random/randu' );
var isnan = require( '@stdlib/math/base/utils/is-nan' );
var EPS = require( '@stdlib/math/constants/float64-eps' );
var pkg = require( './../package.json' ).name;
var rayleigh = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
	var sigma;
	var z;
	var i;

	b.tic();
	for ( i = 0; i < b.iterations; i++ ) {
		sigma = ( randu()*100.0 ) + EPS;
		z = rayleigh( sigma );
		if ( isnan( z ) ) {
			b.fail( 'should not return NaN' );
		}
	}
	b.toc();
	if ( isnan( z ) ) {
		b.fail( 'should not return NaN' );
	} else {
		b.pass( 'benchmark finished' );
	}
	b.end();
});

bench( pkg+':factory', function benchmark( b ) {
	var sigma;
	var rand;
	var z;
	var i;

	sigma = 10.0;
	rand = rayleigh.factory( sigma );

	b.tic();
	for ( i = 0; i < b.iterations; i++ ) {
		z = rand();
		if ( isnan( z ) ) {
			b.fail( 'should not return NaN' );
		}
	}
	b.toc();
	if ( isnan( z ) ) {
		b.fail( 'should not return NaN' );
	} else {
		b.pass( 'benchmark finished' );
	}
	b.end();
});
{'fraction_non_alphanumeric': 0.2094017094017094, 'fraction_numerical': 0.009401709401709401, 'mean_word_length': 2.765273311897106, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7322903', 'n_tokens_mistral': 523, 'n_tokens_neox': 471, 'n_words': 125}