How could I avoid the pc to pick the same number?

前端 未结 0 1500
终归单人心
终归单人心 2020-12-01 18:55

If I have an array like this

int numbers[10] = {1,1,3,3,5,5,7,7,8,8};

And I want to pick one randomly

i = numbers[rand()% 10]         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题