Path: utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.mac Subject: Re: Lightspeed C bug? Message-ID: <8712242049.AA01511@cory.Berkeley.EDU> Date: 24 Dec 87 20:49:51 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 13 >I would expect that your best (hack) answer is to use: > x = Random()&7; >or > x = Random()&~(-1) % N; > for randoms on 0..N-1. I think you meant to say (16 bit ints): x = (Random()&0x7FFF) % N As ~(-1) == 0 -Matt