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