x
 
1
<!DOCTYPE html>
2
<title>My Example</title>
3
4
5
<p id="msg"></p>
6
7
<script>
8
  // Returns a random integer between min (included) and max (excluded)
9
  function getRandomIntExcludeMax(min, max) {
10
    min = Math.ceil(min);
11
    max = Math.floor(max);
12
    return Math.floor(Math.random() * (max - min)) + min;
13
  }
14
  
15
  document.getElementById("msg").innerHTML = getRandomIntExcludeMax(1, 100);
16
</script>