-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js.map
7 lines (7 loc) · 12 KB
/
index.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["../lib/main.js", "../lib/index.js"],
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar setReadWriteAccessor = require( '@stdlib/utils-define-nonenumerable-read-write-accessor' );\nvar constantFunction = require( '@stdlib/utils-constant-function' );\nvar noop = require( '@stdlib/utils-noop' );\nvar assign = require( '@stdlib/object-assign' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar MAX_VALUE = require( '@stdlib/constants-float64-max' );\nvar rhypergeom = require( '@stdlib/random-base-hypergeometric' ).factory;\nvar iteratorSymbol = require( '@stdlib/symbol-iterator' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an iterator for generating pseudorandom numbers drawn from a hypergeometric distribution.\n*\n* @param {NonNegativeInteger} N - population size\n* @param {NonNegativeInteger} K - subpopulation size\n* @param {NonNegativeInteger} n - number of draws\n* @param {Options} [options] - function options\n* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers\n* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed\n* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state\n* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a nonnegative integer\n* @throws {RangeError} number of draws must be less than or equal to the population size\n* @throws {RangeError} subpopulation size must be less than or equal to the population size\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {Error} must provide a valid state\n* @returns {Iterator} iterator\n*\n* @example\n* var iter = iterator( 10, 5, 3 );\n*\n* var r = iter.next().value;\n* // returns <number>\n*\n* r = iter.next().value;\n* // returns <number>\n*\n* r = iter.next().value;\n* // returns <number>\n*\n* // ...\n*/\nfunction iterator( N, K, n, options ) {\n\tvar opts;\n\tvar iter;\n\tvar rand;\n\tvar FLG;\n\tvar i;\n\tif ( !isNonNegativeInteger( N ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', N ) );\n\t}\n\tif ( !isNonNegativeInteger( K ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', K ) );\n\t}\n\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\tif ( n > N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Number of draws must be less than or equal to the population size. Value: `%u`.', n ) );\n\t}\n\tif ( K > N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Subpopulation size must be less than or equal to the population size. Value: `%u`.', K ) );\n\t}\n\tif ( arguments.length > 3 ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t\tif ( hasOwnProp( opts, 'iter' ) ) {\n\t\t\tif ( !isNonNegativeInteger( opts.iter ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', opts.iter ) );\n\t\t\t}\n\t\t} else {\n\t\t\topts.iter = MAX_VALUE;\n\t\t}\n\t\trand = rhypergeom( N, K, n, opts );\n\t\tif ( opts.prng === void 0 && opts.copy !== false ) {\n\t\t\topts.state = rand.state; // cache a copy of the PRNG state\n\t\t}\n\t} else {\n\t\trand = rhypergeom( N, K, n );\n\t\topts = {\n\t\t\t'iter': MAX_VALUE,\n\t\t\t'state': rand.state // cache a copy of the PRNG state\n\t\t};\n\t}\n\ti = 0;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( opts && opts.prng ) {\n\t\tsetReadOnly( iter, 'seed', null );\n\t\tsetReadOnly( iter, 'seedLength', null );\n\t\tsetReadWriteAccessor( iter, 'state', constantFunction( null ), noop );\n\t\tsetReadOnly( iter, 'stateLength', null );\n\t\tsetReadOnly( iter, 'byteLength', null );\n\t} else {\n\t\tsetReadOnlyAccessor( iter, 'seed', getSeed );\n\t\tsetReadOnlyAccessor( iter, 'seedLength', getSeedLength );\n\t\tsetReadWriteAccessor( iter, 'state', getState, setState );\n\t\tsetReadOnlyAccessor( iter, 'stateLength', getStateLength );\n\t\tsetReadOnlyAccessor( iter, 'byteLength', getStateSize );\n\t}\n\tsetReadOnly( iter, 'PRNG', rand.PRNG );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i > opts.iter ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': rand(),\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn iterator( N, K, n, opts );\n\t}\n\n\t/**\n\t* Returns the PRNG seed.\n\t*\n\t* @private\n\t* @returns {PRNGSeedMT19937} seed\n\t*/\n\tfunction getSeed() {\n\t\treturn rand.PRNG.seed;\n\t}\n\n\t/**\n\t* Returns the PRNG seed length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} seed length\n\t*/\n\tfunction getSeedLength() {\n\t\treturn rand.PRNG.seedLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state length\n\t*/\n\tfunction getStateLength() {\n\t\treturn rand.PRNG.stateLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state size (in bytes).\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state size (in bytes)\n\t*/\n\tfunction getStateSize() {\n\t\treturn rand.PRNG.byteLength;\n\t}\n\n\t/**\n\t* Returns the current pseudorandom number generator state.\n\t*\n\t* @private\n\t* @returns {PRNGStateMT19937} current state\n\t*/\n\tfunction getState() {\n\t\treturn rand.PRNG.state;\n\t}\n\n\t/**\n\t* Sets the pseudorandom number generator state.\n\t*\n\t* @private\n\t* @param {PRNGStateMT19937} s - generator state\n\t* @throws {Error} must provide a valid state\n\t*/\n\tfunction setState( s ) {\n\t\trand.PRNG.state = s;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = iterator;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create an iterator for generating pseudorandom numbers drawn from a hypergeometric distribution.\n*\n* @module @stdlib/random-iter-hypergeometric\n*\n* @example\n* var iterator = require( '@stdlib/random-iter-hypergeometric' );\n*\n* var iter = iterator( 10, 5, 6 );\n*\n* var r = iter.next().value;\n* // returns <number>\n*\n* r = iter.next().value;\n* // returns <number>\n*\n* r = iter.next().value;\n* // returns <number>\n*\n* // ...\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAsB,QAAS,uDAAwD,EACvFC,EAAuB,QAAS,wDAAyD,EACzFC,EAAmB,QAAS,iCAAkC,EAC9DC,EAAO,QAAS,oBAAqB,EACrCC,EAAS,QAAS,uBAAwB,EAC1CC,EAAW,QAAS,gCAAiC,EACrDC,EAAuB,QAAS,uCAAwC,EAAE,YAC1EC,EAAa,QAAS,iCAAkC,EACxDC,EAAY,QAAS,+BAAgC,EACrDC,EAAa,QAAS,oCAAqC,EAAE,QAC7DC,EAAiB,QAAS,yBAA0B,EACpDC,EAAS,QAAS,uBAAwB,EAyC9C,SAASC,EAAUC,EAAGC,EAAGC,EAAGC,EAAU,CACrC,IAAIC,EACAC,EAC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,EAAM,cAAe,IAAK,EACvCnB,EAAamB,EAAM,aAAc,IAAK,IAEtClB,EAAqBkB,EAAM,OAAQM,CAAQ,EAC3CxB,EAAqBkB,EAAM,aAAcO,CAAc,EACvDxB,EAAsBiB,EAAM,QAASQ,EAAUC,CAAS,EACxD3B,EAAqBkB,EAAM,cAAeU,CAAe,EACzD5B,EAAqBkB,EAAM,aAAcW,CAAa,GAEvD9B,EAAamB,EAAM,OAAQC,EAAK,IAAK,EAGhCT,GACJX,EAAamB,EAAMR,EAAgBoB,CAAQ,EAErCZ,EAQP,SAASI,GAAO,CAEf,OADAD,GAAK,EACAD,GAAOC,EAAIJ,EAAK,KACb,CACN,KAAQ,EACT,EAEM,CACN,MAASE,EAAK,EACd,KAAQ,EACT,CACD,CASA,SAASI,EAAKQ,EAAQ,CAErB,OADAX,EAAM,GACD,UAAU,OACP,CACN,MAASW,EACT,KAAQ,EACT,EAEM,CACN,KAAQ,EACT,CACD,CAQA,SAASD,GAAU,CAClB,OAAOlB,EAAUC,EAAGC,EAAGC,EAAGE,CAAK,CAChC,CAQA,SAASO,GAAU,CAClB,OAAOL,EAAK,KAAK,IAClB,CAQA,SAASM,GAAgB,CACxB,OAAON,EAAK,KAAK,UAClB,CAQA,SAASS,GAAiB,CACzB,OAAOT,EAAK,KAAK,WAClB,CAQA,SAASU,GAAe,CACvB,OAAOV,EAAK,KAAK,UAClB,CAQA,SAASO,GAAW,CACnB,OAAOP,EAAK,KAAK,KAClB,CASA,SAASQ,EAAUK,EAAI,CACtBb,EAAK,KAAK,MAAQa,CACnB,CACD,CAKAlC,EAAO,QAAUc,ICzNjB,IAAIqB,EAAO,IAKX,OAAO,QAAUA",
"names": ["require_main", "__commonJSMin", "exports", "module", "setReadOnly", "setReadOnlyAccessor", "setReadWriteAccessor", "constantFunction", "noop", "assign", "isObject", "isNonNegativeInteger", "hasOwnProp", "MAX_VALUE", "rhypergeom", "iteratorSymbol", "format", "iterator", "N", "K", "n", "options", "opts", "iter", "rand", "FLG", "i", "next", "end", "getSeed", "getSeedLength", "getState", "setState", "getStateLength", "getStateSize", "factory", "value", "s", "main"]
}