Date: Thu, 25 May 2000 08:49:55 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Chris Miller cc: djgpp AT delorie DOT com Subject: Re: Random numbers In-Reply-To: <392CB951.34B432E6@chemistry.uq.edu.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 25 May 2000, Chris Miller wrote: > If RAND_MAX is set to 100, then a call to rand() should return an > integer between 0 and 100. However, on my computer, a call to rand() > generates a number between what appears to be hundreds of millions and > 0, even with RAND_MAX set to 100. You cannot control `rand' by setting RAND_MAX, it is a constant that tells you what is the range of numbers produced by `rand'. Changing its value will have no effect, since when `rand' was compiled, it used the original value. The recommended way to generate random numbers from a smaller range is described in section 22.23 of the DJGPP FAQ list, which see.