Want to produce random numbers between 1-45 without repetition

前端 未结 4 1487
你的背包
你的背包 2021-01-29 13:53

I have come across a very strange problem. I have tried to find its solution but in vain. My problem is that I want to create a random number between 1-45 and I don\'t want tha

4条回答
  •  野性不改
    2021-01-29 14:26

    This is working

    function getRandomInt(min, max) {
        return Math.floor(Math.random() * (max - min)) + min;
    }
    

提交回复
热议问题