Edit in JSFiddle

//Math.random() returns a value between 0 and 1
//To get a number between 1 and 10, multiply the number by 10
// To only get a whole number, use Math.floor() to round down
//random number between 0 and 1
//Math.floor(Math.random() * (max - min + 1) ) + min;

var button = document.getElementById("submit");

button.addEventListener("click",function(){
	var max = parseInt(document.getElementById("max").value);
  var min = parseInt(document.getElementById("min").value);
  var answer = document.getElementById("output");
  
	answer.innerText = Math.floor(Math.random() * (max - min + 1) + min);
});

console.log(Math.floor(Math.random() * 8) + 1);

console.log(Math.floor(Math.random() * (15 - 5 + 1)) + 5);
<!-- Easy JavaScript # 35 - Random Number Generator -->
<p>
Welcome to the 35th Easy JavaScript tutorial, part of <a href="http://www.easyprogramming.net">EasyProgramming.net</a>. Last time we briefly covered the Math object in JavaScript, let's continue and work wtih <code>Math.random()</code>.
</p>
<p>
One thing we did in C++ is create a <a href="https://www.easyprogramming.net/tutorials/random_number_generator.php" target="_blank">random number generator</a>. Let's create one in JavaScript!
</p>
<p>
Let's take a look!
</p>
<label for="min">Min:</label>
<input type="text" id="min" />
<label for="max">Max:</label>
<input type="text" id="max" />
<button id="submit">
RANDOMIZE ME
</button>
<p>
Random Number: <span id="output">___</span>
</p>