UNPKG

@stdlib/random-base-lognormal

Version:

Log-normally distributed pseudorandom numbers.

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