@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.11 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import e from"./../../utils/define-nonenumerable-read-only-property.js";import t from"./../../utils/define-nonenumerable-read-only-accessor.js";import n from"./../../utils/define-nonenumerable-read-write-accessor.js";import r from"./../../utils/constant-function.js";import o from"./../../utils/noop.js";import i from"./../../utils/copy.js";import s from"./../../assert/is-positive-number.js";import a from"./../../assert/is-plain-object.js";import u from"./../../assert/is-nonnegative-integer.js";import m from"./../../assert/has-own-property.js";import l from"./../../constants/math/float64-max.js";import f from"./../base/poisson.js";import p from"./../../symbol/iterator.js";var c=e,d=t,g=n,h=r,b=o,j=i,v=s.isPrimitive,y=a,P=u.isPrimitive,L=m,w=l,G=f.factory,N=p;function R(e,t){var n,r,o,i,s;if(!v(e))throw new TypeError("invalid argument. First argument must be a positive number. Value: `"+e+"`.");if(arguments.length>1){if(!y(t))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+t+"`.");if(n=j(t,1),L(n,"iter")){if(!P(n.iter))throw new TypeError("invalid option. `iter` option must be a nonnegative integer. Option: `"+n.iter+"`.")}else n.iter=w;o=G(e,n),void 0===n.prng&&!1!==n.copy&&(n.state=o.state)}else o=G(e),n={iter:w,state:o.state};return s=0,c(r={},"next",a),c(r,"return",u),n&&n.prng?(c(r,"seed",null),c(r,"seedLength",null),g(r,"state",h(null),b),c(r,"stateLength",null),c(r,"byteLength",null)):(d(r,"seed",l),d(r,"seedLength",f),g(r,"state",E,T),d(r,"stateLength",p),d(r,"byteLength",x)),c(r,"PRNG",o.PRNG),N&&c(r,N,m),r;function a(){return s+=1,i||s>n.iter?{done:!0}:{value:o(),done:!1}}function u(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}}function m(){return R(e,n)}function l(){return o.PRNG.seed}function f(){return o.PRNG.seedLength}function p(){return o.PRNG.stateLength}function x(){return o.PRNG.byteLength}function E(){return o.PRNG.state}function T(e){o.PRNG.state=e}}var x=R;export default x;
//# sourceMappingURL=poisson.js.map