boost::random を使用して、一様分布に従う確率変数を生成します。
boost::mt19937 gen(2014/*time(NULL)*/);
boost::uniform_real<> dist(0, 1);
boost::variate_generator<boost::mt19937&, boost::uniform_real<> > random(gen, dist);
この変数を使用して、実験ごとに異なる開始グラフ ノードを一様に選択します。
for(unsigned int i=0; i < numQueries; i++)
{
//source node id
sourceID = (unsigned int) ( 1 + random() * G.getNumNodes());
//...
}
しかし、プログラムの実行ごとにシードを異なる方法で初期化する方法が必要です。現在、実行ごとにノードを開始する同じシーケンスを取得しているためです。