C++ 随机整数

[a, b) 之内的随机整数

(rand() % (b-a)) + a

[a, b] 之间的随机整数

(rand() % (b-a+1)) + a
posted @ 2021-11-01 23:51  consolexinhun  阅读(58)  评论(0编辑  收藏  举报