UNPKG

@stdlib/esm

Version:

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

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