simple-squiggle/node_modules/seedrandom/lib/xorshift7.min.js

1 line
969 B
JavaScript
Raw Normal View History

!function(n,t,e){function o(n){var i=this;i.next=function(){var n,t,e=i.x,r=i.i;return n=e[r],t=(n^=n>>>7)^n<<24,t^=(n=e[r+1&7])^n>>>10,t^=(n=e[r+3&7])^n>>>3,t^=(n=e[r+4&7])^n<<7,n=e[r+7&7],t^=(n^=n<<13)^n<<9,e[r]=t,i.i=r+1&7,t},function(n,t){var e,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,e=0;e<t.length;++e)r[7&e]=r[7&e]<<15^t.charCodeAt(e)+r[e+1&7]<<13;for(;r.length<8;)r.push(0);for(e=0;e<8&&0===r[e];++e);for(8==e?r[7]=-1:r[e],n.x=r,n.i=0,e=256;0<e;--e)n.next()}(i,n)}function u(n,t){return t.x=n.x.slice(),t.i=n.i,t}function r(n,t){null==n&&(n=+new Date);function e(){return(r.next()>>>0)/4294967296}var r=new o(n),i=t&&t.state;return e.double=function(){do{var n=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},e.int32=r.next,e.quick=e,i&&(i.x&&u(i,r),e.state=function(){return u(r,{})}),e}t&&t.exports?t.exports=r:e&&e.amd?e(function(){return r}):this.xorshift7=r}(0,"object"==typeof module&&module,"function"==typeof define&&define);