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,fa81b07d7c3d2d7d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-01 13:15:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!in.nntp.be!news.grnet.gr!news.ntua.gr!not-for-mail From: "Papastefanos Serafeim" Newsgroups: comp.lang.ada Subject: Re: Random numbers in tasks Date: Sun, 1 Jun 2003 21:05:41 +0300 Organization: National Technical University of Athens, Greece Message-ID: References: NNTP-Posting-Host: athe530-n174.otenet.gr X-Trace: ulysses.noc.ntua.gr 1054498524 12155 212.205.246.174 (1 Jun 2003 20:15:24 GMT) X-Complaints-To: usenet@ulysses.noc.ntua.gr NNTP-Posting-Date: Sun, 1 Jun 2003 20:15:24 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.lang.ada:38290 Date: 2003-06-01T21:05:41+03:00 List-Id: There is a small problem in that solution, I cannot just declare the generator in the task type: There is a function in a different package that is used to return a random number in a given range and that function is used at other places too... Also, those tasks print some things on the screen. Is there a 'smart' way so that each task's output will not get confused with the output of the others ? "Bobby D. Bryant" wrote in message news:pan.2003.06.01.03.42.32.191321@mail.utexas.edu... > On Sat, 31 May 2003 21:09:30 -0500, David C. Hoos wrote: > > > "Papastefanos Serafeim" wrote in message > > news:bbb8o5$2711$1@ulysses.noc.ntua.gr... > > >> I am trying to model a simulation in Ada95 with gnat. There are some > >> tasks of the same type that use random numbers. Is there a way to make > >> every task get its own sequence of random numbers ? > >> > > Yes. The task body should declare the generator object. Each instance > > of the task type, therefore will have its own generator object. > > And initialize them with different seeds, or they'll all spew the same > stream of numbers. > > -- > Bobby Bryant > Austin, Texas >