Date: Wed, 5 Jul 2000 09:16:30 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Sean Proctor cc: djgpp AT delorie DOT com Subject: Re: Random Numbers? In-Reply-To: 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 Tue, 4 Jul 2000, Sean Proctor wrote: > > return rand() * (long long)range / (RAND_MAX + (long long)1) + min; > I think better would be: > return (rand() % (max - min + 1)) + min; The FAQ explains in section 22.23 why this is a bad idea.