From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5291fa0ea59b8b29 X-Google-Attributes: gid103376,public From: kst@thomsoft.com (Keith Thompson) Subject: Re: Random Number Generation Date: 1996/10/01 Message-ID: #1/1 X-Deja-AN: 186587331 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <52p14c$h7e@newton.cc.rl.ac.uk> organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada originator: kst@pulsar Date: 1996-10-01T00:00:00+00:00 List-Id: In stt@houdini.camb.inmet.com (Tucker Taft) writes: [...] > The standard Float random number generator generates values uniformly > distributed from 0.0 to 1.0. By multiplying these values by the number > of distinct integers wanted, and then (carefully) "pushing" them to a > neighboring exact integral value, you can get a uniform distribution > across any desired sequence of integers, provided the number of distinct > integers is significantly less than the period of the underlying generator. And provided that type Float has more significant mantissa bits than the size of the integral type. If you're generating 32-bit integers by scaling 32-bit floating-point values, the large-scale distribution will be ok but all the results are likely to be multiples of some large power of 2. -- Keith Thompson (The_Other_Keith) kst@thomsoft.com <*> TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706 FIJAGDWOL