UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 2.68 kB
// 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"./../../assert/is-plain-object.js";import o from"./../../assert/is-function.js";import i from"./../../assert/has-own-property.js";import a from"./../../utils/constant-function.js";import s from"./../../utils/noop.js";import u from"./mt19937.js";import p from"./../../math/base/assert/is-nan.js";import m from"./../../array/to-json.js";import l from"./../../assert/is-positive-number.js";import f from"./../../math/base/special/pow.js";var g=l.isPrimitive;function c(e,t){return g(e)?g(t)?null:new TypeError("invalid argument. `beta` must be a positive number. Value: `"+t+"`."):new TypeError("invalid argument. `alpha` must be a positive number. Value: `"+e+"`.")}var d=f;function b(e,t,n){return n/d(e(),1/t)}var h=e,v=t,y=n,j=r,w=o,L=i,N=a,E=s,O=u.factory,T=p,P=m,V=c,G=b;function R(){var e,t,n,r,o,i;if(0===arguments.length)r=O();else if(1===arguments.length){if(!j(n=arguments[0]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+n+"`.");if(L(n,"prng")){if(!w(n.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+n.prng+"`.");r=n.prng}else r=O(n)}else{if(i=V(e=arguments[0],t=arguments[1]))throw i;if(arguments.length>2){if(!j(n=arguments[2]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+n+"`.");if(L(n,"prng")){if(!w(n.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+n.prng+"`.");r=n.prng}else r=O(n)}else r=O()}return h(o=void 0===e?c:g,"NAME","pareto-type1"),n&&n.prng?(h(o,"seed",null),h(o,"seedLength",null),y(o,"state",N(null),E),h(o,"stateLength",null),h(o,"byteLength",null),h(o,"toJSON",N(null)),h(o,"PRNG",r)):(v(o,"seed",a),v(o,"seedLength",s),y(o,"state",m,l),v(o,"stateLength",u),v(o,"byteLength",p),h(o,"toJSON",f),h(o,"PRNG",r),r=r.normalized),o;function a(){return r.seed}function s(){return r.seedLength}function u(){return r.stateLength}function p(){return r.byteLength}function m(){return r.state}function l(e){r.state=e}function f(){var n={type:"PRNG"};return n.name=o.NAME,n.state=P(r.state),n.params=void 0===e?[]:[e,t],n}function g(){return G(r,e,t)}function c(e,t){return T(e)||T(t)||e<=0||t<=0?NaN:G(r,e,t)}}var A=R,J=A(),M=e,S=J,x=R;M(S,"factory",x);export default S; //# sourceMappingURL=pareto-type1.js.map