boost之数学与数字

1.random随机数产生,需要种子,下面以时间为种子示例:

#include <iostream>
#include <string>
#include <vector>
#include <ctime>
#include <boost/random.hpp>
using namespace std;
using namespace boost;

int main()
{
	mt19937 rng(time(0));
	for (int i  = 0;i < 100;++i)
	{
		cout << rng() << "-" <<endl;
	}
	return 0;
}

 

posted @ 2013-08-17 12:24  l851654152  阅读(277)  评论(0编辑  收藏  举报