Lesiok is correct; calling qsrand() more than once is not something you need to do.
As for repeating numbers: that's going to depend partly on what range you give your functions. If you're generating numbers within a narrow range, repeats are going to occur very frequently.
Although there are many, many different tests for randomness, the simplest one would be to check the frequency of each number; ideally, they should all occur the same number of times over a large run. You can also concoct series metrics by determining the probability that two, three or more numbers would occur after one another, and compare that to the output of your function.
My guess is that qrand is doing what it's supposed to do. Nearly all of the problems I've run across involving RNGs can be traced to misunderstandings on the part of those using the routines.
Note, too, that ALL numerical RNGs repeat the same sequence of numbers over and over and over again; algorithms are chosen that produce series with extremely long periods, but it is the nature of deterministic calculation that no such procedure can ever generate truly random numbers. It can only produce a stream of numbers that displays attributes very close to what would be expected from a truly random process.
Bookmarks