boost库随机函数中的bug
最近几天用到随机数比较多,网上搜索发现boost库中有很多很好用的库函数,于是就下载,安装配置了。
以下是原始的生成随机数的程序:
/* parent process*/
#include <iostream>
#include <fstream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <boost/random.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/cauchy_distribution.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/uniform_real.hpp>
#include <string.h>
using namespace std;
void Rand_Select_Particle( int base, int *result, double *real, int num, int population_size )
{
boost::mt19937 gen(time(0));
boost::uniform_int<> unif_int( 0, population_size-1 );
boost::variate_generator< boost::mt19937&, boost::uniform_int<> > unif_dist_int( gen, unif_int );
boost::unif