Simple Random Generator

Simple Random Generator

This is a simple random Generator.Insert minimum value and maximum to generate any number.

Min Range:
Max Range:

javaScript Code:

<body>
<h class="custom">Simple Random Generator</h>
</br>
<p>This is a simple random Generator.Insert minimum value and maximum to generate any number.</p>
Min Range: <input id="in1" type="number" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;" size="10" maxlength="30" ><br>
Max Range:<input id="in2" type="number" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;" size="10" maxlength="30" ><br>
<button class="button" onclick="myFunction()">Generate</button>
<p style="font-size:50px;" id="output"></p>
<script>
function myFunction() {
var min = document.getElementById("in1").value;
var max = document.getElementById("in2").value;
var random =Math.floor(Math.random() * (+max - +min)) + +min; 
document.getElementById("output").innerHTML = random;
}
</script>
</body>

Leave a Reply