| delorie.com/archives/browse.cgi | search |
| From: | "Randy" <umgrang0 AT cc DOT umanitoba DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: srand() |
| Date: | Sat, 25 Sep 1999 12:58:43 -0400 |
| Organization: | The University of Manitoba |
| Lines: | 19 |
| Message-ID: | <7sj2oj$256$1@canopus.cc.umanitoba.ca> |
| References: | <7shlcr$bn2$1 AT canopus DOT cc DOT umanitoba DOT ca> <37ec69fb DOT 17055060 AT news DOT uswest DOT net> <37ECFF5F DOT AAD52476 AT btinternet DOT com> |
| NNTP-Posting-Host: | annex4-20.cc.umanitoba.ca |
| X-Trace: | canopus.cc.umanitoba.ca 938282579 2214 130.179.153.180 (25 Sep 1999 18:02:59 GMT) |
| X-Complaints-To: | Postmaster AT cc DOT umanitoba DOT ca |
| NNTP-Posting-Date: | 25 Sep 1999 18:02:59 GMT |
| X-Newsreader: | Microsoft Outlook Express 4.72.3110.1 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
> You do realise that 'time' only returns the time accurate to the second,
and
>so, if your 645 runs were consecutive, this wasn't a very good test?
Can you suggest what to use instead?
This is what I have used, but wondered if there was a better (simpler) way
to do this:
void randomizer() {
time_t current_time;
struct tm *t;
int seed;
current_time = time(NULL);
t = localtime(¤t_time);
srand(t->tm_sec + 60*t->tm_min + t->tm_hour*60*60);
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |