作业帮 > 综合 > 作业

关于C++随机数的简单问题: srand(time(NULL)); 这一句在C++程序中的作用

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/11 17:39:34
关于C++随机数的简单问题: srand(time(NULL)); 这一句在C++程序中的作用
还有能不能解释一下在C++中产生随机数的具体方法和原理.
gen ju shi jian de bu tong chan sheng bu tong de sui ji shu ,bu yong zhe ge ,mei ci chan sheng de shu dou shi yi yang de ,.
fang fa shi
#include
srand(time(0));
int a=rand()%10;
a jiu shi yi ge mo shi de sui ji shu ,ni shi shi?