UNPKG

@stdlib/random-base-logistic

Version:

Logistic distributed pseudorandom numbers.

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