利用C++11产生随机数

来源:互联网 发布:数据库设计的四个阶段 编辑:程序博客网 时间:2024/05/31 19:30
/*************************************************************************    > File Name: random.cpp    > Author:     > Mail:     > Created Time: Sun 09 Apr 2017 11:19:19 PM CST ************************************************************************/#include<iostream>#include<random>using namespace std;int main(){  random_device rd;  for(int n=0; n<10; ++n)    cout << rd() % 100 << " ";    cout<<endl;  return 0;}
0 0
原创粉丝点击