Mail Archives: djgpp/1997/08/31/01:36:39
that's b/c srand() changes the seed for rand() but not for random() ...
there is some other function to change the 'random()' seed,
can't recall now ;-(
HTH,
-amit.
Heathen (ah897 AT detroit DOT freenet DOT org) wrote:
: In article <01bcaa71$4c08c200$0d5e4ec2 AT xyy>, xyy AT infonie DOT be says...
: >
: >
: >Hi!
: >
: >
: >I still can't obtain truly random numbers with the srand(), random(), and
: >rand() functions, because, whatever the seed number i put in srand(), it is
: >_always the same results.
: >
: >What can i do about it ?
: >
: > A+. Xyy.
: >
: >
:
: Hey here's a neat trick I used with Borland's C++ 3.0 from awhile ago for Random
: Number Generater:
:
: #include <dos.h>
:
: Main(){
:
: int Jims_Rand_Num;
: gettime(&ti_hund);
:
: // Not sure if this was time.ti_hund;
: // But your referencing the time struct in DOS.H
:
: Jims_Rand_Num = ti_hund;
:
: }
:
: It's Been awhile so you may have to play with it but it's great because it returns a random
: percentage. and that can be broken down to random 1-10 etc.
:
: hope I helped!
:
- Raw text -