function randomRange(myMin, myMax) {
return Math.floor(Math.random() * (myMax - myMin + 1) + myMin);
}
var myMin = 1;
var myMax = 10;
function randomRange(myMin, myMax) {
return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
}
console.log(randomRange(myMin, myMax));
import random
print("Generating 3 random integer number between 100 and 999 divisible by 5")
for num in range(3):
print(random.randrange(100, 999, 5), end=', ')
function roundWholeNum(){
return Math.floor(Math.random() * 20);
}
console.log(roundWholeNum());
<script>
// Function to generate random number
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
document.write("Random Number between 1 and 100: ")
// Function call
document.write( randomNumber(1, 100) );
</script>