#include <ctime>
#include <iostream>
#include <boost/random.hpp>
using namespace std;
int main()
{
	using namespace boost;
	cout.setf( ios::fixed );
	{
		// 「線形合同法」( Seed=42 ) で
		// 「一様乱数」(0.0以上1.0未満) を生成
		minstd_rand    gen( 42 );
		uniform_real<> dst( 0, 1 );
		variate_generator<
			minstd_rand&, uniform_real<>
		> rand( gen, dst );
		// 値を取り出すときは () で。
		for( int i=0; i<10; ++i )
			cout << rand() << endl;
		cout << endl;
	}
	{
		// 「メルセンヌツイスター」( Seed=現在時刻 ) で
		// 「小さな整数の一様乱数」( 1~6 ) を生成
		mt19937            gen( static_cast<unsigned long>(time(0)) );
		uniform_smallint<> dst( 1, 6 );
		variate_generator<
			mt19937&, uniform_smallint<>
		> rand( gen, dst );
		for( int i=0; i<10; ++i )
			cout << rand() << endl;
		cout << endl;
	}
	{
		// 「遅延フィボナッチ法」( Seed=おまかせ )
		// 「正規分布」( 平均μ=100, 標準偏差σ=20 )
		lagged_fibonacci1279 gen;
		normal_distribution<> dst( 100.0, 20.0 );
		variate_generator<
			lagged_fibonacci1279&, normal_distribution<>
		> rand( gen, dst );
		for( int i=0; i<10; ++i )
			cout << rand() << endl;
		cout << endl;
	}
	{
		// 「この論文の方法」( Seed=100 )
		// 「ベルヌーイ分布」( 確率変数 p=0.6 )
		hellekalek1995 gen( 100 );
		bernoulli_distribution<> dst( 0.6 );
		variate_generator<
			hellekalek1995&, bernoulli_distribution<>
		> rand( gen, dst );
		for( int i=0; i<10; ++i )
			cout << rand() << endl;
		cout << endl;
	}
	return 0;
}
	0.000944 0.571363 0.256809 0.447674 0.654139 0.966970 0.628985 0.716352 0.042059 0.227523 4 1 2 5 6 2 4 1 1 1 106.121794 59.329111 85.569261 100.352195 117.378101 92.160037 87.949767 75.004497 91.061817 87.173537 1 1 1 1 1 0 0 1 1 1
		C標準ライブラリの rand, srand は、
		適当に簡単なゲームなどを作る分には十分すぎるくらい十分なのですが、
		「seedをグローバルに持っているので扱いにくい」
		「乱数生成アルゴリズムがあまりよろしくないかも」
		「決まった範囲の整数値を生成するのみなので加工してから使わないといけない」
		など幾つか問題点があって、本格的に使うにはいささか力不足です。
		そこで、boost::random。
	
		生成アルゴリズム色々 と
		分布色々 を組み合わせて使います。
		対応する環境であれば、ソフト的に疑似乱数を計算するのではなく
		random_device を通して、
		真に確率的な乱数を利用することもできるそうな。