|
Boost Users : |
From: Andre Tampubolon (andrehpt_at_[hidden])
Date: 2005-11-23 02:36:39
This is my first Boost program
#include <iostream>
#include <cstdlib>
#include <boost\random.hpp>
using namespace std;
using namespace boost;
typedef boost::mt19937 BaseGenerator;
typedef boost::uniform_real<double> Distribution;
typedef boost::variate_generator<BaseGenerator,Distribution> Generator;
double boostDoubleRand()
{
static BaseGenerator base;
static Distribution dist;
static Generator rng(base,dist);
return rng();
}
int main()
{
cout << "expect 5 numbers within the interval [0,1)" << endl;
for (int i = 0; i < 5; i++)
{
cout << boostDoubleRand() << "\n";
}
cout << endl;
return 0;
}
Compiled using Borland C++ 5.6.4 and it works well. But when I compile it using MingW GCC, it only prints "expect 5 numbers within the interval [0,1)" and not the 5 random numbers.
Why ?
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net