🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #23147

Re: Lightspeed C bug?

#23147
From: Matt Dillon
Date: Thu, 24 Dec 1987 20:49
13 lines
555 bytes
>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
Technical Details
Message-ID: <8712242049.AA01511@cory.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!CORY.BERKELEY.EDU!dillon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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