From: "Klytu" Newsgroups: comp.os.msdos.djgpp Subject: Re: random number generator Date: Fri, 10 Nov 2000 16:10:02 -0500 Lines: 8 Message-ID: <8uho7f$5ft$1@bob.news.rcn.net> References: X-Trace: RbkaZZJkyd6j9GdDC1repH8FqRao5rEos7Ykw+9sq03YIChcUJuOPA== X-Complaints-To: abuse AT rcn DOT com NNTP-Posting-Date: 10 Nov 2000 21:10:07 GMT X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com a = (rand() >> 4) % 6 + 1; ^^^^^^^^^^^^^^^^^^^^ So simple and elegant! It had never occurred to me to use the shift operator for this purpose! And you would not believe the way I labored and the contortions I went through to try to drop those "four extremely non-random low-order bits"! :-)