Skip to content

Instantly share code, notes, and snippets.

@bphamict
Last active January 3, 2026 19:56
Show Gist options
  • Select an option

  • Save bphamict/dce685d7738a4e31ed2685dfa0e52e0a to your computer and use it in GitHub Desktop.

Select an option

Save bphamict/dce685d7738a4e31ed2685dfa0e52e0a to your computer and use it in GitHub Desktop.
Tampermonkey script to generate preset numbers on random.org page
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.random.org/widgets/integers/iframe?title=True+Random+Number+Generator&buttontxt=Generate&width=160&height=230&border=on&bgcolor=%23FFFFFF&txtcolor=%23777777&altbgcolor=%23CCCCFFA&alttxtcolor=%23000000&defaultmin=1&defaultmax=100&fixed=off
// @icon https://www.google.com/s2/favicons?domain=random.org
// @grant none
// ==/UserScript==
const initDate=()=>{
const date=new Date().toISOString();
const a=date.split('T');
const b=a[1].split('.');
return `${a[0]} ${b[0]} UTC`;
}
const initResult=(num,min,max)=>{
return `<center><span style="font-size:100%;font-weight:bold;">${num}<br></span><span style="font-size:70%;">Min:&nbsp;${min}, Max:&nbsp;${max}<br>${initDate()}</span></center>`}
(function() {
'use strict';
let a=[1,2,3];
let b=document.getElementById('true-random-integer-generator-button');
let c=document.getElementById('true-random-integer-generator-result');
let d=b.onclick;
let i=0;
const min=document.getElementById('true-random-integer-generator-min');
const max=document.getElementById('true-random-integer-generator-max');
b.onclick=function(){c.innerHTML='<img src="/util/cp/images/ajax-loader.gif" alt="Loading..." />';setTimeout(function(){c.innerHTML=initResult(a[i],min.value,max.value);i++},1500);if(i==(a.length-1)){b.onclick=d}};
})();
@wizzyto12
Copy link
Copy Markdown

How does this work? Replacing any of the iframe js files didnt affect it.

@bphamict
Copy link
Copy Markdown
Author

bphamict commented Jul 24, 2021

How does this work? Replacing any of the iframe js files didnt affect it.

I updated, You need to install tampermonkey extension first, then import the script. Visit to https://www.random.org to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment