Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!goanna!sheoak!737104 From: 737104@sheoak.bcae.oz (David Thiele) Newsgroups: comp.sys.amiga.tech Subject: rand() within a range. Message-ID: <666@sheoak.bcae.oz> Date: 3 Dec 90 23:20:23 GMT Reply-To: 737104@sheoak.bcae.oz (David Thiele) Organization: Student Stress Centre Lines: 21 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!), Random(range,seed) int range,seed; { srand(seed); if range = 0 return(0); else{ do seed = rand() / 10000000; while (seed >= range); return(seed); } } urrgghh! help Dave