| www.delorie.com/archives/browse.cgi | search |
| From: | "Klytu" <jazzyjeff34 AT hotmail DOT com> |
| 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: | <GnIO5.10922$Wd3 DOT 1222073 AT typhoon DOT mn DOT mediaone DOT net> <ki5n0t4s6ldr1gftmo95i6bs5sg0c7dg20 AT 4ax DOT com> |
| 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"! :-)
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |