标签:
#include <random>
#include <iostream>
using namespace std;
void random_number() {
default_random_engine g;
uniform_int_distribution<int> rand(0,9);
for (int i=0; i<10; i++) cout << rand(g) << " ";
cout << endl;
uniform_real_distribution<float> uniform(0,1);
for (int i=0; i<10; i++) cout << uniform(g) << " ";
cout << endl;
}
int main() {
random_number();
return 0;
}
需要C++ 11 支持。
标签:
原文地址:http://www.cnblogs.com/marginalman/p/4797867.html