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,3e9f592176b8fb05,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-25 07:34:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: blchrist@terpalum.umd.edu (Brien) Newsgroups: comp.lang.ada Subject: Random Number Generator Problem Date: 25 Jul 2003 07:34:23 -0700 Organization: http://groups.google.com/ Message-ID: <30c81431.0307250634.77148b62@posting.google.com> NNTP-Posting-Host: 151.190.254.108 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1059143664 10024 127.0.0.1 (25 Jul 2003 14:34:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 25 Jul 2003 14:34:24 GMT Xref: archiver1.google.com comp.lang.ada:40807 Date: 2003-07-25T14:34:24+00:00 List-Id: Preface: I'm using GNAT on a windows box. I'm generating a series of unsigned 64 bit integers and I get the same value for about half of the results. The ada built-in random number generator seems to be giving me 2**63 much more often than any other number. I can't figure out why this would be. Here is some sample code to demonstrate my problem. with Interfaces; with Ada.Numerics.Discrete_Random; with Ada.Text_Io; use Ada.Text_Io; procedure Generate_Random_Test is type Unsigned_Dbl_Integer is new Interfaces.Unsigned_64; package Rand is new Ada.Numerics.Discrete_Random(Unsigned_Dbl_Integer); Rand_Gen : Rand.Generator; begin for I in 1..1000 loop Put_Line(Unsigned_Dbl_Integer'Image(Rand.Random(Rand_Gen))); end loop; end Generate_Random_Test; When I run this code, i get 9,233,........,808 (which is 2**63) as about half of my results. Thanks for the help!