UNPKG

@stdlib/esm

Version:

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

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