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,4231869cc877ceb9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-26 10:58:40 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Andrew Newsgroups: comp.lang.ada Subject: Re: random number generation Date: Fri, 26 Sep 2003 12:58:05 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:43006 Date: 2003-09-26T12:58:05-05:00 List-Id: tmoran@acm.org wrote: >>I need to write a program to randomly grab a integer from 1 - 4,and >>Does this exist in Ada? > > type Options is range 1 .. 4; > package Generate_Options is new Ada.Numerics.Discrete_Random(Options); > A_Generator : Generate_Options.Generator; > ... > X := Generate_Options.Random(A_Generator); > Ada.Text_IO.Put_Line("Selected option is" & Options'image(X)); > You could of course replace type Options with > type Suits is (Spades, Hearts, Diamonds, Clubs); > and have several Dealers instead of a single A_Generator, and so forth. > > >> I don't believe it does from what I have been reading. > > What have you been reading? If your book doesn't cover random > number generation, you can go to the authoritative source, section > A.5.2 of the Ada 95 Reference Manual (available online). thank you to both of you