<commit_before>/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
var isnan = require( '@stdlib/assert/is-nan' );
var isObject = require( '@stdlib/assert/is-plain-object' );
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var MAX_VALUE = require( '@stdlib/constants/math/float64-max' );
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
var rarcsine = require( '@stdlib/random/base/arcsine' ).factory;
var iteratorSymbol = require( './iterator_symbol.js' );


// MAIN //

/**
* Returns an iterator for generating pseudorandom numbers drawn from an arcsine distribution.
*
* @param {number} a - minimum support
* @param {number} b - maximum support
* @param {Options} [options] - function options
* @param {*} [options.seed] - pseudorandom number generator seed
* @param {NonNegativeInteger} [options.iterations] - number of iterations
* @throws {TypeError} `a` must be a number
* @throws {TypeError} `b` must be a number
* @throws {RangeError} `a` must be less than `b`
* @throws {TypeError} options must be an object
* @throws {TypeError} must provide valid options
* @returns {Iterator} iterator
*
* @example
* var iter = iterator( 2.0, 5.0 );
*
* var r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* // ...
*/
function iterator( a, b, options ) {
	var niter;
	var iter;
	var rand;
	var FLG;
	var i;
	if ( !isNumber( a ) || isnan( a ) ) {
		throw new TypeError( 'invalid input argument. First argument must be a number primitive and not `NaN`. Value: `'+a+'`.' );
	}
	if ( !isNumber( b ) || isnan( b ) ) {
		throw new TypeError( 'invalid input argument. Second argument must be a number primitive and not `NaN`. Value: `'+b+'`.' );
	}
	if ( a >= b ) {
		throw new RangeError( 'invalid input argument. Minimum support `a` must be less than maximum support `b`. Value: `['+a+','+b+']`.');
	}
	if ( arguments.length > 2 ) {
		if ( !isObject( options ) ) {
			throw new TypeError( 'invalid input argument. Options argument must be an object. Value: `'+options+'`.' );
		}
		if ( hasOwnProp( options, 'iterations' ) ) {
			niter = options.iterations;
			if ( !isNonNegativeInteger( niter ) ) {
				throw new TypeError( 'invalid option. `iterations` option must be a nonnegative integer. Option: `'+niter+'`.' );
			}
		}
		rand = rarcsine( a, b, options );
	} else {
		niter = MAX_VALUE;
		rand = rarcsine( a, b );
	}
	i = 0;

	// Create an iterator protocol-compliant object:
	iter = {};
	setReadOnly( iter, 'next', next );
	setReadOnly( iter, 'return', end );
	setReadOnly( iter, 'SEED', rand.SEED );

	// If an environment supports `Symbol.iterator`, make the iterator iterable:
	if ( iteratorSymbol !== null ) {
		setReadOnly( iter, iteratorSymbol, factory );
	}
	return iter;

	/**
	* Returns an iterator protocol-compliant object containing the next iterated value.
	*
	* @private
	* @returns {Object} iterator protocol-compliant object
	*/
	function next() {
		i += 1;
		if ( FLG || i > niter ) {
			return {
				'done': true
			};
		}
		return {
			'value': rand(),
			'done': false
		};
	}

	/**
	* Finishes an iterator.
	*
	* @private
	* @param {*} [value] - value to return
	* @returns {Object} iterator protocol-compliant object
	*/
	function end( value ) {
		FLG = true;
		if ( arguments.length ) {
			return {
				'value': value,
				'done': true
			};
		}
		return {
			'done': true
		};
	}

	/**
	* Returns a new iterator.
	*
	* @private
	* @returns {Iterator} iterator
	*/
	function factory() {
		return iterator( a, b, {
			'seed': rand.SEED,
			'iterations': niter
		});
	}
}


// EXPORTS //<commit_msg>Read iterator property<commit_after>/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
var isnan = require( '@stdlib/assert/is-nan' );
var isObject = require( '@stdlib/assert/is-plain-object' );
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var MAX_VALUE = require( '@stdlib/constants/math/float64-max' );
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
var rarcsine = require( '@stdlib/random/base/arcsine' ).factory;
var iteratorSymbol = require( './iterator_symbol.js' );


// MAIN //

/**
* Returns an iterator for generating pseudorandom numbers drawn from an arcsine distribution.
*
* @param {number} a - minimum support
* @param {number} b - maximum support
* @param {Options} [options] - function options
* @param {*} [options.seed] - pseudorandom number generator seed
* @param {NonNegativeInteger} [options.iterations] - number of iterations
* @throws {TypeError} `a` must be a number
* @throws {TypeError} `b` must be a number
* @throws {RangeError} `a` must be less than `b`
* @throws {TypeError} options must be an object
* @throws {TypeError} must provide valid options
* @returns {Iterator} iterator
*
* @example
* var iter = iterator( 2.0, 5.0 );
*
* var r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* // ...
*/
function iterator( a, b, options ) {
	var niter;
	var iter;
	var rand;
	var FLG;
	var i;
	if ( !isNumber( a ) || isnan( a ) ) {
		throw new TypeError( 'invalid input argument. First argument must be a number primitive and not `NaN`. Value: `'+a+'`.' );
	}
	if ( !isNumber( b ) || isnan( b ) ) {
		throw new TypeError( 'invalid input argument. Second argument must be a number primitive and not `NaN`. Value: `'+b+'`.' );
	}
	if ( a >= b ) {
		throw new RangeError( 'invalid input argument. Minimum support `a` must be less than maximum support `b`. Value: `['+a+','+b+']`.');
	}
	if ( arguments.length > 2 ) {
		if ( !isObject( options ) ) {
			throw new TypeError( 'invalid input argument. Options argument must be an object. Value: `'+options+'`.' );
		}
		if ( hasOwnProp( options, 'iterations' ) ) {
			niter = options.iterations;
			if ( !isNonNegativeInteger( niter ) ) {
				throw new TypeError( 'invalid option. `iterations` option must be a nonnegative integer. Option: `'+niter+'`.' );
			}
		}
		rand = rarcsine( a, b, options );
	} else {
		niter = MAX_VALUE;
		rand = rarcsine( a, b );
	}
	i = 0;

	// Create an iterator protocol-compliant object:
	iter = {};
	setReadOnly( iter, 'next', next );
	setReadOnly( iter, 'return', end );
	setReadOnly( iter, 'SEED', rand.SEED );

	// If an environment supports `Symbol.iterator`, make the iterator iterable:
	if ( iteratorSymbol !== null ) {
		setReadOnly( iter, iteratorSymbol, factory );
	}
	return iter;

	/**
	* Returns an iterator protocol-compliant object containing the next iterated value.
	*
	* @private
	* @returns {Object} iterator protocol-compliant object
	*/
	function next() {
		i += 1;
		if ( FLG || i > niter ) {
			return {
				'done': true
			};
		}
		return {
			'value': rand(),
			'done': false
		};
	}

	/**
	* Finishes an iterator.
	*
	* @private
	* @param {*} [value] - value to return
	* @returns {Object} iterator protocol-compliant object
	*/
	function end( value ) {
		FLG = true;
		if ( arguments.length ) {
			return {
				'value': value,
				'done': true
			};
		}
		return {
			'done': true
		};
	}

	/**
	* Returns a new iterator.
	*
	* @private
	* @returns {Iterator} iterator
	*/
	function factory() {
		return iterator( a, b, {
			'seed': iter.SEED,
			'iterations': niter
		});
	}
}


// EXPORTS //
{'fraction_non_alphanumeric': 0.14912181303116148, 'fraction_numerical': 0.004305949008498584, 'mean_word_length': 3.5007649158592553, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5711048', 'n_tokens_mistral': 3037, 'n_tokens_neox': 2870, 'n_words': 964}