function rnd(start, end){
    return Math.floor(Math.random() * (end - start) + start)
}

如rnd(10, 100)将产生10~100之间的整数,其中Math.random()产生0-1的随机数,乘以(100-10)将得到0~90的数,再加上10得到10~100的数,然后用Math.floor对该结果取整。