function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min);
}
What it does "extra" is it allows random intervals that do not start with 1. So you can get a random number from 10 to 15 for example.
(它“额外”的作用是允许以1开头的随机间隔。因此,例如,您可以获得10到15之间的随机数。)
Flexibility. (灵活性。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…