www.delorie.com/archives/browse.cgi | search |
Xref: | news2.mv.net comp.os.msdos.djgpp:5134 |
From: | xenophon AT atl DOT mindspring DOT com (Derek Owens) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Random numbers ... |
Date: | Tue, 18 Jun 1996 14:15:02 GMT |
Organization: | MindSpring Enterprises, Inc. |
Lines: | 22 |
Message-ID: | <4q6dkj$1j6s@mule1.mindspring.com> |
References: | <4q3o4g$b6o AT infoserv DOT rug DOT ac DOT be> <31C607D9 DOT 2E67 AT netam DOT net> |
Reply-To: | xenophon AT atl DOT mindspring DOT com |
NNTP-Posting-Host: | user-168-121-104-192.dialup.mindspring.com |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Ridge <ridge AT netam DOT net> wrote: >Johan De Messemaeker wrote: >> int tmp; >> tmp = random(3); >int tmp; >tmp=random()%3; or maybe try: int tmp; tmp = rand()%3; But this is actually far from "random". You might want to use srand() to seed the random number generator with a value from the clock at the beginning of the program. I was also wondering... How fast is the something like rand()%3? -Derek Owens
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |