www.delorie.com/archives/browse.cgi | search |
Date: | Sun, 2 May 1999 11:38:00 +0300 (IDT) |
From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
X-Sender: | eliz AT is |
To: | Stephan <saf AT magic DOT fr> |
cc: | djgpp AT delorie DOT com |
Subject: | Re: random() / randomizer / srandom(...) problems! |
In-Reply-To: | <372AF740.2B18DBC@magic.fr> |
Message-ID: | <Pine.SUN.3.91.990502113506.563g-100000@is> |
MIME-Version: | 1.0 |
Reply-To: | djgpp AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
On Sat, 1 May 1999, Stephan wrote: > Hi have written a program that use random functions. > But the randomizer doesn't work! You need to call `srandom' with a different seed in order to get a different series of random numbers. The usual trick is to pass the current system clock as the seed. See section 22.22 in the DJGPP FAQ for more details. Also, `srandom' goes with `random', not with `rand'. If you need to randomize the series returned by `rand', use `srand' instead of `srandom'.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |