NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Hijack RNG
// @namespace https://www.google.com/
// @version 0.1
// @description Hijacks Google's RNG!
// @author You
// @include https://www.google.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
const hijackGenBtn = document.querySelector('#ZdzlKb')
function randNum(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
if (hijackGenBtn) {
hijackGenBtn.addEventListener('click', e => {
// prevent the default code from running
e.stopPropagation()
const minInput = document.querySelector('#UMy8j')
const maxInput = document.querySelector('#nU5Yvb')
const min = Math.ceil(minInput.value)
const max = Math.floor(maxInput.value)
const myArray = ['44', '474', '747', '447744']
const answer = myArray[Math.floor(Math.random() * myArray.length)]
var Local = 0;
sessionStorage.LocalToGlobalVar = Local;
if (sessionStorage.LocalToGlobalVar == 0){
answer == 99;
}
const rollCount = 4
const waitDuration = 100
const output = document.querySelector('.gws-csf-randomnumber__result')
for (let i = 0; i < rollCount; i++) {
// build suspense
setTimeout(() => {
output.innerText = randNum(min, max)
}, waitDuration * i)
// actually displaying the results
setTimeout(() => {
output.innerText = answer || 0
}, waitDuration * rollCount + 1)
}
})
}
})();