编程语言
首页 > 编程语言> > C++ 生成随机数

C++ 生成随机数

作者:互联网

#include <vector>
#include <iostream>
#include <random>
#include <ctime>

int main()
{
	std::default_random_engine e(time(0));
	std::uniform_real_distribution<double> u(0, 1);
	//std::uniform_int_distribution<double> u(0, 100);
	
	for (int a=0;a<10;a++)
	{
		double ss = u(e);
		std::cout << ss << std::endl;
	}
	getchar();
	return 0;
}

标签:std,engine,int,uniform,C++,生成,随机数,distribution,include
来源: https://blog.csdn.net/u013174817/article/details/123637008