-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchainrand.min.js
1 lines (1 loc) · 6.64 KB
/
chainrand.min.js
1
!function(r,n){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=n(r,1):n(r)}("undefined"!=typeof window?window:this,function(r,n){"use strict";var t={CRNG:function(r){function n(r){for(var n=[];r--;)n.push(0);return n}function h(r){return"number"==typeof r&&!isNaN(r)}function v(r){return"[object Array]"===Object.prototype.toString.call(r)}function o(r){for(var n=0;n<16;++n)r[n]=l[r[n]]}function f(r,n,t){for(var o=0;o<16;++o)n[o]^=t[16*r+o]}function e(r){var n;n=r[1],r[1]=r[5],r[5]=r[9],r[9]=r[13],r[13]=n,n=r[2],r[2]=r[10],r[10]=n,n=r[6],r[6]=r[14],r[14]=n,n=r[3],r[3]=r[15],r[15]=r[11],r[11]=r[7],r[7]=n}function u(r){return 255&(r<<1^27*(r>>7&1))}function i(r){var n,t,o,f;for(n=0;n<4;++n)f=r[4*n+0],t=r[4*n+0]^r[4*n+1]^r[4*n+2]^r[4*n+3],o=u(o=r[4*n+0]^r[4*n+1]),r[4*n+0]^=o^t,o=u(o=r[4*n+1]^r[4*n+2]),r[4*n+1]^=o^t,o=u(o=r[4*n+2]^r[4*n+3]),r[4*n+2]^=o^t,o=u(o=r[4*n+3]^f),r[4*n+3]^=o^t}arguments.length<1&&(r="");var l=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],a=n(240),c=n(16),s=n(16),d=n(16),p=0,g=[141,1,2,4,8,16,32,64,128,27,54];function m(){if(16<p+8&&(p=0),0==p){for(var r=0;r<16;++r)d[r]=s[r];f(0,d,c),f(0,d,a);for(var n=1;n<14;++n)e(d),o(d),i(d),f(n,d,a);for(e(d),o(d),f(14,d,a),r=0;r<16;++r)c[r]=d[r];for(r=0;r<16;++r){if(s[r]<255){++s[r];break}s[r]=0}}var t=(d[p+1]>>3)+32*d[p+2]+8192*d[p+3]+2097152*d[p+4]+536870912*d[p+5]+137438953472*d[p+6]+35184372088832*d[p+7];return p+=8,t/9007199254740992}!function(r,n){var t,o,f,e,u,i,a,c;for(t=0;t<8;++t)r[4*t+0]=n[4*t+0],r[4*t+1]=n[4*t+1],r[4*t+2]=n[4*t+2],r[4*t+3]=n[4*t+3];for(t=8;t<60;++t)e=r[0+(f=4*(t-1))],u=r[f+1],i=r[f+2],a=r[f+3],t%8==0&&(c=e,e=l[e=u],u=l[u=i],i=l[i=a],a=l[a=c],e^=g[t>>3]),t%8==4&&(e=l[e],u=l[u],i=l[i],a=l[a]),f=4*(t-8),r[0+(o=4*t)]=r[f+0]^e,r[1+o]=r[f+1]^u,r[2+o]=r[f+2]^i,r[3+o]=r[f+3]^a}(a,function(r){function u(){var r,n,t,o,f,e,u,i,a,c=y,l=j,h=w,v=x,s=A,d=C,p=N,g=k,m=b;for(r=16;r<64;++r)n=((f=m[r-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3,t=((f=m[r-2])>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,m[r]=m[r-16]+n+m[r-7]+t<<0;for(a=l&h,r=0;r<64;r+=4)q?(e=704751109,g=(f=m[0]-210244248)-1521486534<<0,v=f+143694565<<0,q=!1):(n=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),o=(e=c&l)^c&h^a,g=v+(f=g+(t=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&d^~s&p)+M[r]+m[r])<<0,v=f+(n+o)<<0),n=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),o=(u=v&c)^v&l^e,p=h+(f=p+(t=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&s^~g&d)+M[r+1]+m[r+1])<<0,n=((h=f+(n+o)<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),o=(i=h&v)^h&c^u,d=l+(f=d+(t=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&g^~p&s)+M[r+2]+m[r+2])<<0,n=((l=f+(n+o)<<0)>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),o=(a=l&h)^l&v^i,s=c+(f=s+(t=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&p^~d&g)+M[r+3]+m[r+3])<<0,c=f+(n+o)<<0;y=y+c<<0,j=j+l<<0,w=w+h<<0,x=x+v<<0,A=A+s<<0,C=C+d<<0,N=N+p<<0,k=k+g<<0}"0123456789abcdef".split("");var i,t=[-2147483648,8388608,32768,128],a=[24,16,8,0],M=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=n(17),y=1779033703,j=3144134277,w=1013904242,x=2773480762,A=1359893119,C=2600822924,N=528734635,k=1541459225,c=0,l=0,h=0,v=0,s=!1,q=!0;return function(r){for(var n,t,o=0,f=r.length,e=b;o<f;){if(s)for(s=!1,e[0]=c,t=1;t<17;++t)e[t]=0;for(t=l;o<f&&t<64;++o)(n=r.charCodeAt(o))<128?e[t>>2]|=n<<a[3&t++]:(n<2048?e[t>>2]|=(192|n>>6)<<a[3&t++]:(n<55296||57344<=n?e[t>>2]|=(224|n>>12)<<a[3&t++]:(n=65536+((1023&n)<<10|1023&r.charCodeAt(++o)),e[t>>2]|=(240|n>>18)<<a[3&t++],e[t>>2]|=(128|n>>12&63)<<a[3&t++]),e[t>>2]|=(128|n>>6&63)<<a[3&t++]),e[t>>2]|=(128|63&n)<<a[3&t++]);h+=(i=t)-l,64<=t?(c=e[16],l=t-64,u(),s=!0):l=t}4294967295<h&&(v+=h/4294967296<<0,h%=4294967296)}(r),function(){var r=b,n=i;if(r[16]=c,r[n>>2]|=t[3&n],c=r[16],56<=n)for(s||u(),r[0]=c,n=1;n<17;++n)r[n]=0;r[14]=v<<3|h>>>29,r[15]=h<<3,u()}(),[y>>24&255,y>>16&255,y>>8&255,255&y,j>>24&255,j>>16&255,j>>8&255,255&j,w>>24&255,w>>16&255,w>>8&255,255&w,x>>24&255,x>>16&255,x>>8&255,255&x,A>>24&255,A>>16&255,A>>8&255,255&A,C>>24&255,C>>16&255,C>>8&255,255&C,N>>24&255,N>>16&255,N>>8&255,255&N,k>>24&255,k>>16&255,k>>8&255,255&k]}(r)),m.random=function(){return m()},m.randrange=function(r,n,t){var o;if(!h(r)){if(!h(n))return null;o=n,n=r,r=o}h(n)||(n=r,r=0),h(t)||(t=1),n<r&&(t=-t);var f=Math.floor(Math.abs((n-r)/t));return r+Math.floor(f*m())*t},m.randint=function(r,n){var t;if(!h(r)){if(!h(n))return null;t=n,n=r,r=t}return h(n)||(n=r,r=0),n<r&&(t=n,n=r,r=t),Math.floor(r+(n+1-r)*m())},m.shuffle=function(r){for(var n,t,o=r.length-1;0<o;o--)n=r[t=Math.floor((o+1)*m())],r[t]=r[o],r[o]=n;return r},m.sample=function(r,n,t){var o,f,e,u,i={},a=0,c=[],l=v(t);if(!v(r))return c;if(u=r.length,l){for(u=Math.min(u,t.length),o=0;o<u;++o)a+=t[o];l=0<a}for(l||(a=u=r.length),n=Math.max(0,h(n)?n:1),f=0;f<n;++f)for(e=a*m(),o=0;o<u;++o)i[o]||(e-=l?t[o]:1)<0&&(c.push(r[o]),a-=l?t[o]:1,i[o]=1,o=u);if(c.length<n)for(o=0;o<u;++o)i[o]||c.push(r[o]);return m.shuffle(c)},m.choice=function(r,n){var t=m.sample(r,1,n);return t.length?t[0]:null};var M,b=0;return m.gauss=function(r,n){var t,o,f;if(h(n)||(n=1),h(r)||(r=0),b)return b=0,M*n+r;for(;1<=(t=(o=2*m()-1)*o+(f=2*m()-1)*f)||0===t;);return t=Math.sqrt(-2*Math.log(t)/t),b=1,M=f*t,o*t*n+r},m}};return"function"==typeof define&&define.amd&&define("chainrand",[],function(){return t}),n||(r.chainrand=t),t});