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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7fc42d2c6a0eedc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-05 01:00:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Ada2005 random References: X-Newsreader: Tom's custom newsreader Message-ID: <2Xwja.370890$S_4.443638@rwcrnsc53> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1049533246 12.234.13.56 (Sat, 05 Apr 2003 09:00:46 GMT) NNTP-Posting-Date: Sat, 05 Apr 2003 09:00:46 GMT Organization: AT&T Broadband Date: Sat, 05 Apr 2003 09:00:46 GMT Xref: archiver1.google.com comp.lang.ada:35950 Date: 2003-04-05T09:00:46+00:00 List-Id: > Ok, but integer has a range of -(2 ** 31) .. +(2 ** 31 - 1) so the difference > could be something around +/- (x / (2 ** 31 - 1)) ! A small error if x is small, but rather large if x is, say, 3/8 * 2**31 If the generator's range = a*x+b, then (random mod x) will take values < b a+1 times and values >= b only a times. If a is small, a/(a+1) will differ substantially from 1.0 Also, there's no guarantee that the generator's range is Integer or that it is 32 bits wide.