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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,219de4148f968c92,start X-Google-Attributes: gid103376,public From: Andreas Almroth Subject: Strange results with random numbers with Gnat 3.10 Date: 1998/01/07 Message-ID: <34B3F618.DC9@uppsala.mail.telia.com>#1/1 X-Deja-AN: 313736138 X-NNTP-Posting-Host: t3o61p17.telia.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: A3CE, Advanced Computer Engineering Mime-Version: 1.0 Reply-To: andreas.almroth@uppsala.mail.telia.com Newsgroups: comp.lang.ada Date: 1998-01-07T00:00:00+00:00 List-Id: Hi folks, I was wandering through the excellent online RM Ada95 at www.adahome.com and read about the random number facility (A.5.2). I compiled and ran the dice example program, and everything seemed OK. But just as a curiousity I wanted to see how the numbers were actually distributed, so I changed the program to loop one million times, and then present the frequency. To my big suprise this was the result; Number Frequency ================= 1 249594 2 167104 3 166985 4 166687 5 166621 6 83009 A bit odd distribution, if I may say so... Is this a feature of Gnat, or? The reference manual clearly states that; " Implementation Requirements (41) A sufficiently long sequence of random numbers obtained by successive calls to Random is approximately uniformly distributed over the range of the result subtype." So, the result should be different... Any comments, or I'm making the wrong conclusions? Of course, one could use 2..5 and skip the min and max values, but why should I do that, if the Ada95 language enviroment should handle it? Regards, Andreas Almroth -- ============================================================ A3CE, Advanced Computer Engineering System Integration Consultants Phone: +46-18-100 790 ============================================================ Any opinions expressed in this letter, are mine, and the company's, because I own it... :-)