Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!hplabs!hpfcso!hpfcbig!aaronf From: aaronf@hpfcbig.SDE.HP.COM (Aaron Friesen) Newsgroups: comp.sys.amiga.tech Subject: Re: rand() within a range. Message-ID: <1230001@hpfcbig.SDE.HP.COM> Date: 5 Dec 90 23:50:49 GMT References: <666@sheoak.bcae.oz> Organization: HP SESD, Fort Collins, CO Lines: 13 sheoak.bcae.oz (David Thiele) / 4:20 pm Dec 3, 1990 / > Is there a way to generate random numbers within a certain range in > Lattice C??. Ive done it with the following code but it's not very > elegant (or fast!), [ Code Deleted... ] Simply taking rand() % range or something similar should give you what you want. This will be fast and about as "random" as the code you are currently using.