When you seed the rng use something decently random, not just time.
If you can, take time in seconds and divide by the lower bits of the tsc (if
the cpu has one) that should mix things a bit better.
bye, scott
From: "Andre Stark" <An.Stark@xxxxxx> Reply-To: openbeos@xxxxxxxxxxxxx To: openbeos@xxxxxxxxxxxxx Subject: [openbeos] is rand() really random? Date: Fri, 09 Apr 2004 23:18:44 +0200 CEST
Hello there, this is not really an OBOS problem, but a BeOS one. Everytime i execute the following code:
for (int i = 0; i < 100; i++) cout << "Random:" << rand() <<endl;
the resulting values are exactly the same? Until now i do'nt know much about C++ programming, but normally random numbers are generated by including system time in some kind. How does this work on BeOS?
Greetings Andre Stark