12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- setup.qsp_rand = function (min, max) {
- min = Math.ceil(min);
- max = Math.floor(max) + 1;
- let randomNumber;
- if(State.temporary.randFunctionOverwrite && State.temporary.randFunctionOverwrite.length > 0){
- randomNumber = State.temporary.randFunctionOverwrite.last()();
- }
- else{
- if(!State.variables.randomNumbers){
- State.variables.randomNumbers = [];
- }
- while(State.variables.randomNumbers.length < 50)
- State.variables.randomNumbers.push(Math.random());
- randomNumber = State.variables.randomNumbers.shift();
- }
- //return Math.floor(State.variables.randomNumbers.shift() * (max - min) + min); // The maximum is inclusive and the minimum is inclusive
- return Math.floor(randomNumber * (max - min) + min); // The maximum is inclusive and the minimum is inclusive
- }
- setup.cyrb128 = function (str) {
- let h1 = 1779033703, h2 = 3144134277,
- h3 = 1013904242, h4 = 2773480762;
- for (let i = 0, k; i < str.length; i++) {
- k = str.charCodeAt(i);
- h1 = h2 ^ Math.imul(h1 ^ k, 597399067);
- h2 = h3 ^ Math.imul(h2 ^ k, 2869860233);
- h3 = h4 ^ Math.imul(h3 ^ k, 951274213);
- h4 = h1 ^ Math.imul(h4 ^ k, 2716044179);
- }
- h1 = Math.imul(h3 ^ (h1 >>> 18), 597399067);
- h2 = Math.imul(h4 ^ (h2 >>> 22), 2869860233);
- h3 = Math.imul(h1 ^ (h3 >>> 17), 951274213);
- h4 = Math.imul(h2 ^ (h4 >>> 19), 2716044179);
- return [(h1^h2^h3^h4)>>>0, (h2^h1)>>>0, (h3^h1)>>>0, (h4^h1)>>>0];
- }
- setup.mulberry32 = function(a) {
- return function() {
- var t = a += 0x6D2B79F5;
- t = Math.imul(t ^ t >>> 15, t | 1);
- t ^= t + Math.imul(t ^ t >>> 7, t | 61);
- return ((t ^ t >>> 14) >>> 0) / 4294967296;
- }
- }
|