#include<random>
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
default_random_engine e;
uniform_real_distribution<double> u(5.0, 30.0);
ofstream out("rule.txt", ios::app);
if (out.is_open())
{
for (int i = 0; i < 35; ++i)
{
float ff = 0;
ff = ((float)((int)((u(e) + 0.005) * 10))) / 10;
ofstream out("data.txt", ios::app);
if (out.is_open())
{
out << ff << ',';
}
}
}
out.close();
system("pause");
return 0;
}
c++11 random引擎使用
最新推荐文章于 2024-06-06 09:16:23 发布