@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.86 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../../utils/define-nonenumerable-read-only-property.js";import t from"./../../utils/define-nonenumerable-read-only-accessor.js";import e 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"./../../math/base/assert/is-nan.js";import m from"./improved-ziggurat.js";import p from"./../../array/to-json.js";import f from"./../../assert/is-number.js";import l from"./../../assert/is-positive-number.js";import g from"./../../assert/is-nan.js";import c from"./../../math/base/special/tan.js";import d from"./../../constants/math/float64-pi.js";var b=f.isPrimitive,h=l.isPrimitive,j=g;function v(r,t){return!b(r)||j(r)?new TypeError("invalid argument. `x0` must be a number primitive and not `NaN`. Value: `"+r+"`."):h(t)?null:new TypeError("invalid argument. `gamma` must be a positive number. Value: `"+t+"`.")}var y=c,w=d;function N(r,t,e){return t+e*y(w*(r()-.5))}var L=r,E=t,O=e,T=n,P=o,V=i,G=s,R=a,x=u,A=m.factory,J=p,M=v,S=N;function z(){var r,t,e,n,o,i,s;if(0===arguments.length)t=A();else if(1===arguments.length){if(!T(e=arguments[0]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+e+"`.");if(V(e,"prng")){if(!P(e.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+e.prng+"`.");t=A({prng:e.prng})}else t=A(e)}else{if(i=M(s=arguments[0],r=arguments[1]))throw i;if(arguments.length>2){if(!T(e=arguments[2]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+e+"`.");if(V(e,"prng")){if(!P(e.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+e.prng+"`.");t=A({prng:e.prng})}else t=A(e)}else t=A()}return o=void 0===s?d:c,n=t.PRNG,L(o,"NAME","cauchy"),e&&e.prng?(L(o,"seed",null),L(o,"seedLength",null),O(o,"state",G(null),R),L(o,"stateLength",null),L(o,"byteLength",null),L(o,"toJSON",G(null))):(E(o,"seed",a),E(o,"seedLength",u),O(o,"state",f,l),E(o,"stateLength",m),E(o,"byteLength",p),L(o,"toJSON",g)),L(o,"PRNG",n),o;function a(){return n.seed}function u(){return n.seedLength}function m(){return n.stateLength}function p(){return n.byteLength}function f(){return n.state}function l(r){n.state=r}function g(){var t={type:"PRNG"};return t.name=o.NAME,t.state=J(n.state),t.params=void 0===s?[]:[s,r],t}function c(){return S(t,s,r)}function d(r,e){return x(r)||x(e)||e<=0?NaN:S(t,r,e)}}var k=z,q=k(),B=r,C=q,D=z;B(C,"factory",D);export default C;
//# sourceMappingURL=cauchy.js.map