@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.6 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"./../../utils/constant-function.js";import i from"./../../utils/noop.js";import o from"./../../utils/copy.js";import a from"./../../assert/is-number.js";import s from"./../../math/base/assert/is-nan.js";import u from"./../../assert/is-plain-object.js";import m from"./../../assert/is-nonnegative-integer.js";import l from"./../../assert/has-own-property.js";import f from"./../../constants/math/float64-max.js";import p from"./../base/triangular.js";import d from"./../../symbol/iterator.js";var g=e,c=t,b=r,h=n,v=i,j=o,y=a.isPrimitive,w=s,N=u,P=m.isPrimitive,L=l,R=f,G=p.factory,T=d;function E(e,t,r,n){var i,o,a,s,u;if(!y(e)||w(e))throw new TypeError("invalid argument. First argument must be a number primitive and not `NaN`. Value: `"+e+"`.");if(!y(t)||w(t))throw new TypeError("invalid argument. Second argument must be a number primitive and not `NaN`. Value: `"+t+"`.");if(!y(r)||w(r))throw new TypeError("invalid argument. Third argument must be a number primitive and not `NaN`. Value: `"+r+"`.");if(!(e<=r&&r<=t))throw new RangeError("invalid arguments. The condition `a <= c <= b` must be satisfied. Value: `["+e+","+t+","+r+"]`.");if(arguments.length>3){if(!N(n))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+n+"`.");if(i=j(n,1),L(i,"iter")){if(!P(i.iter))throw new TypeError("invalid option. `iter` option must be a nonnegative integer. Option: `"+i.iter+"`.")}else i.iter=R;a=G(e,t,r,i),void 0===i.prng&&!1!==i.copy&&(i.state=a.state)}else a=G(e,t,r),i={iter:R,state:a.state};return u=0,g(o={},"next",m),g(o,"return",l),i&&i.prng?(g(o,"seed",null),g(o,"seedLength",null),b(o,"state",h(null),v),g(o,"stateLength",null),g(o,"byteLength",null)):(c(o,"seed",p),c(o,"seedLength",d),b(o,"state",O,F),c(o,"stateLength",V),c(o,"byteLength",x)),g(o,"PRNG",a.PRNG),T&&g(o,T,f),o;function m(){return u+=1,s||u>i.iter?{done:!0}:{value:a(),done:!1}}function l(e){return s=!0,arguments.length?{value:e,done:!0}:{done:!0}}function f(){return E(e,t,r,i)}function p(){return a.PRNG.seed}function d(){return a.PRNG.seedLength}function V(){return a.PRNG.stateLength}function x(){return a.PRNG.byteLength}function O(){return a.PRNG.state}function F(e){a.PRNG.state=e}}var V=E;export default V;
//# sourceMappingURL=triangular.js.map