Mail Archives: djgpp/1997/08/26/07:48:24
From: | ah897 AT detroit DOT freenet DOT org (Heathen)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Random numbers...
|
Date: | 20 Aug 1997 11:52:50 GMT
|
Organization: | C-Rad
|
Lines: | 38
|
Message-ID: | <5telqi$1ue$1@news.kode.net>
|
References: | <01bcaa71$4c08c200$0d5e4ec2 AT xyy>
|
NNTP-Posting-Host: | ppp-425.kode.net
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
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 -