@stdlib/random-base-frechet
Version:
Fréchet distributed pseudorandom numbers.
12 lines (11 loc) • 2.88 kB
JavaScript
;var o=function(n,e){return function(){return e||n((e={exports:{}}).exports,e),e.exports}};var N=o(function(ne,b){
var y=require('@stdlib/assert-is-positive-number/dist').isPrimitive,D=require('@stdlib/assert-is-number/dist').isPrimitive,m=require('@stdlib/assert-is-nan/dist'),p=require('@stdlib/error-tools-fmtprodmsg/dist');function H(n,e,r){return !y(n)||m(n)?new TypeError(p('0oJ7A',n)):!y(e)||m(e)?new TypeError(p('0oJ7B',e)):!D(r)||m(r)?new TypeError(p('0oJ7C',r)):null;}b.exports=H
});var O=o(function(ae,w){
var I=require('@stdlib/math-base-special-pow/dist'),K=require('@stdlib/math-base-special-ln/dist');function Q(n,e,r,t){return t+r*I(-K(n()),-1/e)}w.exports=Q
});var h=o(function(ie,x){
var i=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),g=require('@stdlib/utils-define-nonenumerable-read-only-accessor/dist'),L=require('@stdlib/utils-define-nonenumerable-read-write-accessor/dist'),S=require('@stdlib/assert-is-plain-object/dist'),E=require('@stdlib/assert-is-function/dist'),T=require('@stdlib/assert-has-own-property/dist'),P=require('@stdlib/utils-constant-function/dist'),U=require('@stdlib/utils-noop/dist'),v=require('@stdlib/random-base-mt19937/dist').factory,d=require('@stdlib/math-base-assert-is-nan/dist'),X=require('@stdlib/array-to-json/dist'),f=require('@stdlib/error-tools-fmtprodmsg/dist'),Y=N(),R=O();function Z(){var n,e,r,t,c,u,s;if(arguments.length===0)r=v();else if(arguments.length===1){if(e=arguments[0],!S(e))throw new TypeError(f('0oJ2V',e));if(T(e,"prng")){if(!E(e.prng))throw new TypeError(f('0oJ6u',"prng",e.prng));r=e.prng}else r=v(e)}else{if(n=arguments[0],u=arguments[1],s=arguments[2],c=Y(n,u,s),c)throw c;if(arguments.length>3){if(e=arguments[3],!S(e))throw new TypeError(f('0oJ2V',e));if(T(e,"prng")){if(!E(e.prng))throw new TypeError(f('0oJ6u',"prng",e.prng));r=e.prng}else r=v(e)}else r=v()}return n===void 0?t=C:t=B,i(t,"NAME","frechet"),e&&e.prng?(i(t,"seed",null),i(t,"seedLength",null),L(t,"state",P(null),U),i(t,"stateLength",null),i(t,"byteLength",null),i(t,"toJSON",P(null)),i(t,"PRNG",r)):(g(t,"seed",F),g(t,"seedLength",G),L(t,"state",M,W),g(t,"stateLength",J),g(t,"byteLength",z),i(t,"toJSON",k),i(t,"PRNG",r),r=r.normalized),t;function F(){return r.seed}function G(){return r.seedLength}function J(){return r.stateLength}function z(){return r.byteLength}function M(){return r.state}function W(a){r.state=a}function k(){var a={};return a.type="PRNG",a.name=t.NAME,a.state=X(r.state),n===void 0?a.params=[]:a.params=[n,u,s],a}function B(){return R(r,n,u,s)}function C(a,l,q){return d(a)||d(l)||d(q)||a<=0||l<=0?NaN:R(r,a,l,q)}}x.exports=Z
});var j=o(function(ue,V){
var _=h(),$=_();V.exports=$
});var ee=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),A=j(),re=h();ee(A,"factory",re);module.exports=A;
/** @license Apache-2.0 */
//# sourceMappingURL=index.js.map