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-Thread: 103376,a10fc2d4d530dd05 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!news.mixmin.net!news.tornevall.net!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Random number generation Date: Tue, 13 Jul 2010 09:07:57 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: NNTP-Posting-Host: 1a5b543daf0a86c783d428d7f1c74a35 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 2477c0fba250525b90c6968481626c3d X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-UserIDNumber: 1738 X-Validate-Post: http://news.tornevall.net/validate.php?trace=2477c0fba250525b90c6968481626c3d X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news1.google.com comp.lang.ada:12382 Date: 2010-07-13T09:07:57-07:00 List-Id: On 07/13/2010 05:45 AM, tonyg wrote: > I want to generate a random integer and a random floating point number > between 10 and 30 . I've been looking at previous posts and finding it > a little confusing with many packages, has anyone an already done > example in ada 2005 they can post up? The random integer is pretty easy to do with an appropriate [sub]type and Ada.Numerics.Discrete_Random. The random floating-point is a bit more difficult, and there's always the question of whether 30.0 must be a possible value. You can have a look at Random_Range in PragmARC.Universal_Random: http://pragmada.x10hosting.com/pragmarc.htm which excludes the maximum value from the returned values. -- Jeff Carter "When Roman engineers built a bridge, they had to stand under it while the first legion marched across. If programmers today worked under similar ground rules, they might well find themselves getting much more interested in Ada!" Robert Dewar 62