<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 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 randn = require( '@stdlib/random/base/randn' ).factory;
var iteratorSymbol = require( '@stdlib/symbol/iterator' );


// MAIN //

/**
* Returns an iterator for generating pseudorandom numbers drawn from a standard normal distribution.
*
* @param {Options} [options] - function options
* @param {Function} [options.name='improved-ziggurat'] - name of a supported pseudorandom number generator (PRNG), which will serve as the underlying source of pseudorandom numbers
* @param {*} [options.seed] - pseudorandom number generator seed
* @param {NonNegativeInteger} [options.iter] - number of iterations
* @throws {TypeError} options must be an object
* @throws {TypeError} must provide valid options
* @returns {Iterator} iterator
*
* @example
* var iter = iterator();
*
* var r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* // ...
*/
function iterator( options ) {
	var niter;
	var iter;
	var rand;
	var FLG;
	var i;
	niter = MAX_VALUE;
	if ( arguments.length > 0 ) {
		if ( !isObject( options ) ) {
			throw new TypeError( 'invalid argument. Options argument must be an object. Value: `'+options+'`.' );
		}
		if ( hasOwnProp( options, 'iter' ) ) {
			niter = options.iter;
			if ( !isNonNegativeInteger( niter ) ) {
				throw new TypeError( 'invalid option. `iter` option must be a nonnegative integer. Option: `'+niter+'`.' );
			}
		}
		rand = randn( options );
	} else {
		rand = randn();
	}
	i = 0;

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

	// If an environment supports `Symbol.iterator`, make the iterator iterable:
	if ( iteratorSymbol ) {
		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
		};
	}
<commit_msg>Set properties in consistent order<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 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 randn = require( '@stdlib/random/base/randn' ).factory;
var iteratorSymbol = require( '@stdlib/symbol/iterator' );


// MAIN //

/**
* Returns an iterator for generating pseudorandom numbers drawn from a standard normal distribution.
*
* @param {Options} [options] - function options
* @param {Function} [options.name='improved-ziggurat'] - name of a supported pseudorandom number generator (PRNG), which will serve as the underlying source of pseudorandom numbers
* @param {*} [options.seed] - pseudorandom number generator seed
* @param {NonNegativeInteger} [options.iter] - number of iterations
* @throws {TypeError} options must be an object
* @throws {TypeError} must provide valid options
* @returns {Iterator} iterator
*
* @example
* var iter = iterator();
*
* var r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* r = iter.next().value;
* // returns <number>
*
* // ...
*/
function iterator( options ) {
	var niter;
	var iter;
	var rand;
	var FLG;
	var i;
	niter = MAX_VALUE;
	if ( arguments.length > 0 ) {
		if ( !isObject( options ) ) {
			throw new TypeError( 'invalid argument. Options argument must be an object. Value: `'+options+'`.' );
		}
		if ( hasOwnProp( options, 'iter' ) ) {
			niter = options.iter;
			if ( !isNonNegativeInteger( niter ) ) {
				throw new TypeError( 'invalid option. `iter` option must be a nonnegative integer. Option: `'+niter+'`.' );
			}
		}
		rand = randn( options );
	} else {
		rand = randn();
	}
	i = 0;

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

	// If an environment supports `Symbol.iterator`, make the iterator iterable:
	if ( iteratorSymbol ) {
		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
		};
	}

{'fraction_non_alphanumeric': 0.13649668772146048, 'fraction_numerical': 0.00462178400862733, 'mean_word_length': 3.7982261640798227, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '7485363', 'n_tokens_mistral': 2109, 'n_tokens_neox': 2004, 'n_words': 686}