(function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p;this.chancejs||(this.chancejs={}),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,u=function(){function n(e){this.seed=e!=null?e:0}return h([e("seed"),l("chancejs.NoRandom","seed"),t("NoRandom","seed")])["in"](n),n.prototype.get=function(){return this.seed},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,s=function(){function n(){}return h([e(),l("chancejs.MathRandom"),t("MathRandom")])["in"](n),n.prototype.get=function(){return Math.random()},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,r=function(){function n(e){this.step=e!=null?e:1e9,this.iterator=0}return h([e("step"),l("chancejs.Linear","step"),t("Linear","step")])["in"](n),n.prototype.get=function(){var e;return e=this.iterator++/this.step,this.iterator>this.step&&(this.iterator=0),e},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,i=function(){function n(e){this.seed=e!=null?e:1}return h([e("seed"),l("chancejs.LinearCongruential","seed"),t("LinearCongruential","seed")])["in"](n),n.prototype.plantSeed=function(e){this.seed=e!=null?e:1},n.prototype.get=function(){var e,t,n,r;return r=this.seed,n=r,n<<=1,t=r<<32,e=t+n,e&2147483648&&(e&=2147483647,e++),this.seed=e,e/2147483648},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,n=function(){function n(e){e==null&&(e=0),this.plantSeed(e)}return h([e("seed"),l("chancejs.LaggedFibonnacci","seed"),t("LaggedFibonnacci","seed")])["in"](n),n.prototype.get=function(){var e;return e=this.u[this.i97]-this.u[this.j97],e<0&&(e+=1),this.u[this.i97]=e,--this.i97<0&&(this.i97=96),--this.j97<0&&(this.j97=96),this.c-=this.cd,this.c<0&&(this.c+=this.cm),e-=this.c,e<0&&(e+=1),e},n.prototype.plantSeed=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;e==null&&(e=0),this.u=new Array(97),r=e/30082,u=e-30082*r,t=r/177%177+2,i=r%177+2,o=u/169%178+1,a=u%169;for(n=h=0;h<=96;n=++h){d=[0,.5],l=d[0],c=d[1];for(s=p=0;p<=23;s=++p)f=t*i%179*o%179,v=[i,o,f],t=v[0],i=v[1],o=v[2],a=(53*a+1)%169,a*f%64>=32&&(l+=c),c*=.5;this.u[n]=l}return this.c=362436/16777216,this.cd=7654321/16777216,this.cm=.9999998211860657,this.i97=96,this.j97=32},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,o=function(){function n(e){e==null&&(e=0),this.mt=Array(623),this.z=0,this.y=0,this.plantSeed(e)}return h([e("seed"),l("chancejs.MersenneTwister","seed"),t("MersenneTwister","seed")])["in"](n),n.prototype.plantSeed=function(e){var t,n,r;e==null&&(e=0),this.mt[0]=e,r=[];for(t=n=1;n<=623;t=++n)r.push(this.mt[t]=69069*this.mt[t-1]+1&4294967295);return r},n.prototype.get=function(){return this.z>=623&&this.generateNumbers(),this.extractNumber(this.z++)/2147483648},n.prototype.generateNumbers=function(){var e,t,n;this.z=0,n=[];for(e=t=0;t<=623;e=++t)this.y=2147483648&this.mt[e]+2147483647&this.mt[(e+1)%623],this.y%2===0?n.push(this.mt[e]=this.mt[(e+397)%623]^this.y>>1):n.push(this.mt[e]=this.mt[(e+397)%623]^this.y>>1^2567483615);return n},n.prototype.extractNumber=function(e){return this.y=this.mt[e],this.y^=this.y>>11,this.y^=this.y<<7&2636928640,this.y^=this.y<<15&4022730752,this.y^=this.y>>18},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,a=function(){function n(e){this.seed=e}return h([e("seed"),l("chancejs.PaulHoule","seed"),t("PaulHoule","seed")])["in"](n),n.prototype.get=function(){return this.seed=(this.seed*9301+49297)%233280,this.seed/233280},n}(),e=mixinsjs.Cloneable,l=mixinsjs.Sourcable,t=mixinsjs.Formattable,h=mixinsjs.include,c=Math.floor,p=Math.round,f=function(){function n(e){this.generator=e}return h([e("generator"),l("chancejs.Random","generator"),t("Random","generator")])["in"](n),n.prototype.get=function(){return this.generator.get()},n.prototype.boolean=function(e){return e==null&&(e=.5),0<=e&&e<=1||(e=.5),this.get()0){r=t[s-1];if(r>i)throw new Error("ratios must be ordered when summed is true")}}if(n)o=t[t.length-1],t=t.map(function(e){return e/o});else{f=t.reduce(function(e,t){return e+t}),t=t.map(function(e){return e/f});for(s=h=0,v=t.length;h0&&(t[s]+=t[s-1])}a=this.get();for(s=p=0,m=t.length;p3)return this.inArray(arguments);switch(typeof e){case"number":return this.inRange(e,t);case"string":return this.inArray(e,t,n);case"object":if(Object.prototype.toString.call(e)==="[object Array]")return this.inArray(e,t,n);if(e.min!=null&&e.max!=null)return this.inRange(e.min,e.max,e.step);break;default:return null}},n.prototype.sort=function(){var e=this;return function(){return e.intPad(2)}},n.prototype.random=function(e){return this.get()*(e||1)},n.prototype.intRandom=function(e){return p(this.random(e))},n.prototype.pad=function(e){return e/2-this.random(e)},n.prototype.intPad=function(e){return p(this.pad(e))},n}(),this.chancejs.NoRandom=u,this.chancejs.MathRandom=s,this.chancejs.Linear=r,this.chancejs.LinearCongruential=i,this.chancejs.LaggedFibonnacci=n,this.chancejs.MersenneTwister=o,this.chancejs.PaulHoule=a,this.chancejs.Random=f}).call(this)