Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!psuvm!uh2 From: UH2@psuvm.psu.edu (Lee Sailer) Newsgroups: comp.sys.amiga Subject: Re: Lattice Random Numbers Message-ID: <90266.171043UH2@psuvm.psu.edu> Date: 23 Sep 90 21:10:43 GMT References: <4604@crash.cts.com> Organization: Penn State University Lines: 13 In article <4604@crash.cts.com>, acota@pro-realm.cts.com (Arnold Cota) says: > >How do I generate a random number in the range of 1 to 54 in Lattice C? > Use one of the functions that generate a number in [0,1) (see the manual) multiply by 53 to get a number in [0,53.99999999), add one to get a number in [1.000000, 54.999999999) and assign the result to an integer to truncate. See a book such as Sedgewick's Algorithms for more detail. lee