JSFiddle - React, Tailwind, and code Playground
HTML
<div id="display1"></div>
<div id="display2"></div>
<div id="display3"></div>
<div id="display4"></div>
<div id="display5"></div>
<div id="display6"></div>
JavaScript
var myRand = Math.random();
document.getElementById("display1").innerHTML = "Random floating point number from 0 up to but not including 1 - <strong>" + myRand + "</strong>";
var myRand2 = Math.random() * 10;
document.getElementById("display2").innerHTML = "Random floating point number from 0 up to but not including 10 - <strong>" + myRand2 + "</strong>";
var myRand3 = Math.floor(Math.random() * 10);
document.getElementById("display3").innerHTML = "Random whole number from 0 up to but not including 10 - <strong>" + myRand3 + "</strong>";
var myRand4 = Math.floor(Math.random() * 10) + 1;
document.getElementById("display4").innerHTML = "Random whole number from 1 to 10 - <strong>" + myRand4 + "</strong>";
//random number within a range of two numbers
var max = 10;
var min = 2;
var myRand5 = Math.floor(Math.random () * (max - min + 1) + min);
document.getElementById("display5").innerHTML = "Random whole number between the range of 2 to 10 - <strong>" + myRand5 + "</strong>";
//Another range example
var lgMax = 1000;
var lgMin = 995;
var myRand6 = Math.floor(Math.random () * (lgMax - lgMin + 1) + lgMin);
document.getElementById("display6").innerHTML = "Random whole number between the range of 995 to 1000 - <strong>" + myRand6 + "</strong>";