I use boost::random to generate a random variable that follows uniform distribution.
boost::mt19937 gen(2014/*time(NULL)*/);
boost::uniform_real<> dist(0, 1);
boost::variate_generator<boost::mt19937&, boost::uniform_real<> > random(gen, dist);
With this variable,I uniformly choose a different starting graph node in every different experiment.
for(unsigned int i=0; i < numQueries; i++)
{
//source node id
sourceID = (unsigned int) ( 1 + random() * G.getNumNodes());
//...
}
But I'm in need of a way to initialize the seed differently in each different run of my program, as I get the same sequence of starting nodes in every different run now.