UNPKG

@stdlib/random-base-f

Version:

F distributed pseudorandom numbers.

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