home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!messua!dak
- From: dak@messua.informatik.rwth-aachen.de (David Kastrup)
- Subject: rand() quality. Was: Re: FULL HOUSE (SOLUTION)
- Message-ID: <dak.716561621@messua>
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Nntp-Posting-Host: messua
- Organization: Rechnerbetrieb Informatik / RWTH Aachen
- References: <1992Sep13.223147.28768@wuecl.wustl.edu> <1992Sep14.184939.10440@austin.eds.com>
- Date: 15 Sep 92 12:53:41 GMT
- Lines: 5
-
-
- rand() is maybe not that bad. It only gets misused too often. Using it
- by modulo is the wrong attitude, because the value is distributed more
- or less evenly, not the bits (the less bits you extract, the worse you get).
- Use rand/(MAXUNSIGNED/52 + 1) instead of rand%52.
-