Skip to content

Instantly share code, notes, and snippets.

@cwardzala
Created January 31, 2023 14:42
Show Gist options
  • Save cwardzala/6be2f724a19afdf3c4369b094660147e to your computer and use it in GitHub Desktop.
Save cwardzala/6be2f724a19afdf3c4369b094660147e to your computer and use it in GitHub Desktop.
Random Port JS
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
function newRandomPort() {
document.getElementById("randomport").textContent = "" + getRandomInt(1024, 65534)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment