#include <iostream>
using namespace std;
time_t temp_time;
srand((unsigned)time(&temp_time));//初始化随机种子
int r = (rand() % 256); //0-255
int r1 = (rand() % 10); //0-9
int r2 = (rand() % 100); //0-99
using namespace std;
time_t temp_time;
srand((unsigned)time(&temp_time));//初始化随机种子
int r = (rand() % 256); //0-255
int r1 = (rand() % 10); //0-9
int r2 = (rand() % 100); //0-99
本文介绍如何使用C++编程语言通过初始化随机种子并生成0-255范围内的随机整数,以及0-9和0-99范围内的随机整数。
1万+

被折叠的 条评论
为什么被折叠?



