@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 3.06 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 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"./../../assert/is-number.js";import g from"./../../assert/is-nan.js";import d from"./../../math/base/special/pow.js";import c from"./../../math/base/special/ln.js";var b=l.isPrimitive,h=f.isPrimitive,v=g;function j(e,r,t){return!b(e)||v(e)?new TypeError("invalid argument. First argument must be a positive number primitive and not `NaN`. Value: `"+e+"`."):!b(r)||v(r)?new TypeError("invalid argument. Second argument must be a positive number primitive and not `NaN`. Value: `"+r+"`."):!h(t)||v(t)?new TypeError("invalid argument. Third argument must be a number primitive and not `NaN`. Value: `"+t+"`."):null}var y=d,w=c;function N(e,r,t,n){return n+t*y(-w(e()),-1/r)}var E=e,L=r,T=t,O=n,P=o,V=i,G=a,R=s,S=u.factory,A=m,J=p,M=j,x=N;function z(){var e,r,t,n,o,i,a;if(0===arguments.length)t=S();else if(1===arguments.length){if(!O(r=arguments[0]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.");if(V(r,"prng")){if(!P(r.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+r.prng+"`.");t=r.prng}else t=S(r)}else{if(o=M(e=arguments[0],i=arguments[1],a=arguments[2]))throw o;if(arguments.length>3){if(!O(r=arguments[3]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.");if(V(r,"prng")){if(!P(r.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+r.prng+"`.");t=r.prng}else t=S(r)}else t=S()}return E(n=void 0===e?c:d,"NAME","frechet"),r&&r.prng?(E(n,"seed",null),E(n,"seedLength",null),T(n,"state",G(null),R),E(n,"stateLength",null),E(n,"byteLength",null),E(n,"toJSON",G(null)),E(n,"PRNG",t)):(L(n,"seed",s),L(n,"seedLength",u),T(n,"state",l,f),L(n,"stateLength",m),L(n,"byteLength",p),E(n,"toJSON",g),E(n,"PRNG",t),t=t.normalized),n;function s(){return t.seed}function u(){return t.seedLength}function m(){return t.stateLength}function p(){return t.byteLength}function l(){return t.state}function f(e){t.state=e}function g(){var r={type:"PRNG"};return r.name=n.NAME,r.state=J(t.state),r.params=void 0===e?[]:[e,i,a],r}function d(){return x(t,e,i,a)}function c(e,r,n){return A(e)||A(r)||A(n)||e<=0||r<=0?NaN:x(t,e,r,n)}}var F=z,k=F(),q=e,B=k,C=z;q(B,"factory",C);export default B;
//# sourceMappingURL=frechet.js.map