【发布时间】:2012-01-01 09:51:13
【问题描述】:
可能重复:
Generate Random numbers uniformly over entire range
C++ random float
如何在 c++ 中生成 5 到 25 之间的随机数?
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
void main() {
int number;
int randomNum;
srand(time(NULL));
randomNum = rand();
}
【问题讨论】: