Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!hc!lll-winken!ubvax!ardent!rap!rap From: rap@rap.ardent.com (Rob Peck) Newsgroups: comp.sys.amiga Subject: Re: Bug in Manx 3.6a c.lib Message-ID: <6388@ardent.UUCP> Date: 9 May 89 23:53:17 GMT Sender: news@ardent.UUCP Reply-To: rap@rap.ardent.com (Rob Peck) Organization: Ardent Computer Corp., Sunnyvale, CA Lines: 48 In article griff@intelob.intel.com (Richard Griffith) writes: > >:-) - anyway - I used srand() and rand() to seed and generate the >random number generator - only now it won't run (sdb gives step errors), >I can't seem to find the docs for srand, rand, nor the step errors for !!!!!! You REALLY need the RKM's... !!!!!! /* ********************************************************************* */ extern long RangeSeed; unsigned long rand_32bits, maxval_32bits; unsigned long constrained_rand_32bits, initial_value32bits; RangeSeed = initial_value32bits; rand_32bits = FastRand(); constrained_rand_32bits = RangeRand(maxval_32bits); /* ********************************************************************* */ where: 0 <= constrained_randno_32bits <= maxvalue_32bits The random numbers are established via the "usual manner", if I remember right, exclusive or-ing with something or other and then shifting by some amount or something like it. Also as I remember, RangeRand calls FastRand, and thus both use the established RangeSeed. These functions are in amiga.lib. Note that if you are still compiling with Lattice 3.03 (which, strangely enough, sometimes happens to me if I just don't wanna reach for the main Lattice book (which has 5.02 in it), you won't see these... they came in at the release of the 1.2 amiga.lib and Lattice 3.03 hasn't got em. If it is COST that's got you waiting to get an RKM, I'll sell you my 1.2 versions of the RKM's (a COMPLETE set, Intuition, Exec, and Libraries; maybe even Hardware ... unsure) for 1/3 of the cover price. The 1.3 will be better organized and have better examples, but the 1.2 will at least provide a stopgap until you can scare up a few more funds. Personally I am a book-a-holic, and actually collected two sets of the manuals. Now, for Richard, I can make the extra set available. (and it'd help me to get the 1.3 versions, WHEN they come out). Rob Peck