[openbeos] Re: is rand() really random?
- From: "Scott Donaldson" <a_nqe@xxxxxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Fri, 09 Apr 2004 22:53:01 +0100
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
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger
- Follow-Ups:
- [openbeos] Re: is rand() really random?
- From: Michael Phipps
Other related posts:
- » [openbeos] is rand() really random?
- » [openbeos] Re: is rand() really random?
- » [openbeos] Re: is rand() really random?
- » [openbeos] Re: is rand() really random?
- » [openbeos] Re: is rand() really random?
- » [openbeos] Re: is rand() really random?
- » [openbeos] Re: is rand() really random?
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
- [openbeos] Re: is rand() really random?
- From: Michael Phipps