comp.lang.ada
 help / color / mirror / Atom feed
From: "William J. Thomas" <wjthomas@wcvt.com>
Subject: Re: HOW TO FIX THIS IN ADA?
Date: Thu, 22 Feb 2001 21:21:43 -0500
Date: 2001-02-22T21:21:43-05:00	[thread overview]
Message-ID: <t9bhlglrrrpi68@corp.supernews.com> (raw)
In-Reply-To: 6Izk6.161065$Pm2.3005370@news20.bellglobal.com

Want to fix in Ada? Simple, code in Ada, fix real quick!!!

"Munir Albeelbisi" <munir.albeelbisi@sympatico.ca> wrote in message
news:6Izk6.161065$Pm2.3005370@news20.bellglobal.com...
> 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;
>
>





      parent reply	other threads:[~2001-02-23  2:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-20 19:37 HOW TO FIX THIS IN ADA? Munir Albeelbisi
2001-02-20 20:37 ` Pascal Obry
2001-02-20 20:38 ` How to write this in Ada, was " tmoran
2001-02-21  8:56 ` Martin Dowie
2001-02-22  4:44 ` Lao Xiao Hai
2001-02-22 17:48   ` Pascal Obry
2001-02-23  3:22     ` Lao Xiao Hai
2001-02-23  4:08     ` Jeffrey Carter
2001-02-23 17:18       ` Pascal Obry
2001-02-24  4:40         ` Jeffrey Carter
2001-02-24  9:22           ` Pascal Obry
2001-02-22  7:17 ` tmoran
2001-02-22 16:43   ` Al Christians
2001-02-23  2:21 ` William J. Thomas [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox