I am creating a treap, and I want to know, which random number generator is most suitable for generating priorities at insertion.
The data set is about 6000 items long.
I am modifying an existing template class(largely just declared methods without definitions) that was given to us. The predefined generator is std::default_random_engine
which only generates pseudo-random numbers. I would like to know, if this generator is sufficient, and if not, what are the alternatives? The data will be read from a file all at once.
The random number generator is declared as:
std::default_random_engine* generator_;
It's only used when creating in a constructor of a wrapper class
TreapItem<K, T>(key, data, (*generator_)())
I'd like to have the least number of collisions possible. Is std::default_random_engine* generator_;
enough, to achieve no collisions, or is there a need for some other generator?
EDIT: I'd prefer uniform distribution, or something that is close to it. Normal distribution might work too, however.
The pointer to the generator was in the given code, it didn't appear as a flaw at first glance.