quote:
Original post by Noods
I have actually seen the ''MT'' but I am still learning C++ and I dont quite understand the code. I have found that the rand and srand dont generate quality random numbers, I usually ended up with duplicate stats, and stats that were constantly too low. I am optimally looking for a function that I can send a maximum, minimum and possibly an interval to, and it can send back a random number within the givens sepecifications. Im not expecting anyone to code this out and send it to me, (although it would be nice) but any incite on how to do this would be appreciated. The problem is, is that generating a quality random number is not easy, especially for someone who is semi new. Timkin - I have emailed you but have not received a response. No rush, just letting you know. Thanks for the help.
-Noods
Actually the MT is not C++ but is instead C. Treat it as a "black box" and don''t worry about what
they are doing within, as long as it produces a quality set of psuedo-random numbers, what do you care?
FWIW, getting a quality random number is trivial. Just use MT or as Timkin suggested, one of Knuth''s RNG.
As for your max/min/interval request, you can always scale the output of any RNG to meet your needs.
Look up the ''%'' (modulus) operator in C, I think you will find it useful for getting your max/min handled.
Experiment a bit, and you will be rewarded.
Good Luck.
Eric