@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 3.05 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 r from"./../../utils/define-nonenumerable-read-write-accessor.js";import n from"./../../assert/is-iterator-like.js";import o from"./../../assert/is-positive-number.js";import i from"./../../assert/is-plain-object.js";import s from"./../../assert/is-function.js";import a from"./../../assert/is-boolean.js";import u from"./../../assert/is-uint32array.js";import m from"./../../assert/has-own-property.js";import p from"./../../utils/copy.js";import l from"./../../utils/noop.js";import f from"./../../utils/constant-function.js";import d from"./../../symbol/iterator.js";import c from"./../../random/base/uniform.js";import g from"./../../constants/math/float64-sqrt-three.js";var y=!0,h={copy:y},b=e,v=t,j=r,w=n,L=o.isPrimitive,T=i,E=s,x=a.isPrimitive,N=u,P=m,O=p,q=l,G=f,R=d,V=c.factory,k=g,A=h;function F(e,t,r){var n,o,i,s,a;if(!w(e))throw new TypeError("invalid argument. First argument must be an iterator. Value: `"+e+"`.");if(!L(t))throw new TypeError("invalid argument. Second argument must be a positive number. Value: `"+t+"`.");if(o=O(A),arguments.length>2){if(!T(r))throw new TypeError("invalid argument. Third argument must be an object. Value: `"+r+"`.");if(P(r,"copy")&&(o.copy=r.copy,!x(r.copy)))throw new TypeError("invalid option. `copy` option must be a boolean. Option: `"+r.copy+"`.");if(P(r,"prng")){if(!E(r.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+r.prng+"`.");o.prng=r.prng}else if(P(r,"state")){if(o.state=r.state,!N(r.state))throw new TypeError("invalid option. `state` option must be a Uint32Array. Option: `"+r.state+"`.")}else if(P(r,"seed")&&(o.seed=r.seed,void 0===r.seed))throw new TypeError("invalid option. `seed` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `"+r.seed+"`.")}return n=V(-(a=t*k),a,o),b(i={},"next",c),b(i,"return",g),R&&E(e[R])&&b(i,R,y),r&&r.prng?(b(i,"seed",null),b(i,"seedLength",null),j(i,"state",G(null),q),b(i,"stateLength",null),b(i,"byteLength",null),b(i,"PRNG",r.prng)):(v(i,"seed",u),v(i,"seedLength",m),j(i,"state",f,d),v(i,"stateLength",p),v(i,"byteLength",l),b(i,"PRNG",n.PRNG)),i;function u(){return n.seed}function m(){return n.seedLength}function p(){return n.stateLength}function l(){return n.byteLength}function f(){return n.state}function d(e){n.state=e}function c(){var t,r;return s?{done:!0}:(t={},"number"==typeof(r=e.next()).value?t.value=r.value+n():P(r,"value")&&(t.value=NaN),r.done?(s=!0,t.done=!0):t.done=!1,t)}function g(e){return s=!0,arguments.length?{value:e,done:!0}:{done:!0}}function y(){return F(e[R](),t,o)}}var S=F;export default S;
//# sourceMappingURL=awun.js.map