C++ generating random numbers

后端 未结 11 1626
我寻月下人不归
我寻月下人不归 2020-12-01 10:49

My output is 20 random 1\'s, not between 10 and 1, can anyone explain why this is happening?

#include  
#include  
#include <         


        
11条回答
  •  执念已碎
    2020-12-01 11:15

    What about using a condition to check if the last number is the same as the current one? If the condition is met then generate another random number. This solution works but it will take more time though.

提交回复
热议问题