From: "Papastefanos Serafeim" <serafeim@otenet.gr>
Subject: Re: Random numbers in tasks
Date: Sun, 1 Jun 2003 21:05:41 +0300
Date: 2003-06-01T21:05:41+03:00 [thread overview]
Message-ID: <bbdmsr$brr$1@ulysses.noc.ntua.gr> (raw)
In-Reply-To: pan.2003.06.01.03.42.32.191321@mail.utexas.edu
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" <bdbryant@mail.utexas.edu> 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" <serafeim@otenet.gr> 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
>
next prev parent reply other threads:[~2003-06-01 18:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-31 22:01 Random numbers in tasks Papastefanos Serafeim
2003-06-01 2:09 ` David C. Hoos
2003-06-01 3:42 ` Bobby D. Bryant
2003-06-01 18:05 ` Papastefanos Serafeim [this message]
2003-06-01 21:31 ` tmoran
2003-06-02 2:24 ` Bobby D. Bryant
2003-06-02 3:29 ` Robert I. Eachus
2003-06-02 5:32 ` Bobby D. Bryant
2003-06-02 14:35 ` Papastefanos Serafeim
2003-06-02 20:50 ` Robert I. Eachus
2003-06-03 19:37 ` Papastefanos Serafeim
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox