I am using this following piece of code and calling it in a loop so that i can get multiple random numbers for my perfect hash function. But it is giving me same number, not distinct. "min" receives 0 or 1 and max receives "p-1". Where p is a prime number greater then hash table size.
long long int generateSingleRandomNo2(long long int min, long long int max)
{
typedef boost::uniform_int<long long int> NumberDistribution;
typedef boost::mt19937 RandomNumberGenerator;
typedef boost::variate_generator<RandomNumberGenerator&,NumberDistribution> Generator;
NumberDistribution distribution(min,max);
RandomNumberGenerator generator;
Generator numberGenerator(generator, distribution);
generator.seed(time(0)); // seed with the current time
long long int A=numberGenerator();
return A;
/*if(A>min)
return A ;
else
generateSingleRandomNo1(min,max);*/
}