Message-ID: <34D50550.48ED@quantum.de> Date: Mon, 02 Feb 1998 00:29:20 +0100 From: Tom Chojnacki Reply-To: chojnack AT quantum DOT de Organization: Quantum Software GmbH, Dortmund, Germany MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: random number in range Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Hi! A little problem: how can I get random number from a given range. Is the following solution efficient or maybe there is any ready-made function ? long rnd(long low, long high) { long r; srandom((int)time(0)); while (((r = random()) < low) || (r > high)) ; return r; }