任意の範囲に含まれるランダムな整数を生成する方法

<html>
  <button onclick="alert(getRandomNumber(1,6));">さいころ</button>
</html>
<script>
  function getRandomNumber(min, max) {
    const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
    return randomNumber;
  }
</script>