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,REPLYTO_WITHOUT_TO_CC, SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,81080984e3a87d27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-21 20:50:05 PST Path: supernews.google.com!sn-xit-03!supernews.com!news-feed.riddles.org.uk!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: Lao Xiao Hai Newsgroups: comp.lang.ada Subject: Re: HOW TO FIX THIS IN ADA? Date: Wed, 21 Feb 2001 20:44:55 -0800 Organization: AdaWorks Software Engineering Message-ID: <3A949947.52E9B5F4@ix.netcom.com> References: <6Izk6.161065$Pm2.3005370@news20.bellglobal.com> Reply-To: richard@adaworks.com NNTP-Posting-Host: 3f.35.b5.6c MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 22 Feb 2001 04:46:41 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:5415 Date: 2001-02-22T04:46:41+00:00 List-Id: Well, on first glance at this code, it is clear it will never compile. Unless I am not reading it correctly, there is a missing return statement in the function. Richard Riehle Munir Albeelbisi wrote: > with Ada.Text_IO; use Ada.Text_IO; > > PROCEDURE Random(Output) IS ; > seed1 = 5; seed2 = 10000; seed3 = 3000; > x, y, z : integer; > looop : integer; > FUNCTION Unif return real is > tmp : real; > Begin > x := 171*(x mod 177) - 2*(x div 177); > if x<0 then x := x + 30269; > y := 172*(y mod 176) -35*(y div 176); > if y<0 then y := y + 30307; > z := 170*(z mod 178) -63*(z div 178); > if z<0 then z := z + 30323; > tmp := x/30269.0 + y/30307.0 + z/30323.0; > Unif := tmp - trunc(tmp); > End; {Unif} > BEGIN > x := seed1; y := seed2; z := seed3; > for looop := 1.. 1000 loop > writeln(loop:4, ' ==> ', unif:7:5); > END loop; > END unif;