comp.lang.ada
 help / color / mirror / Atom feed
From: "Bobby D. Bryant" <bdbryant@mail.utexas.edu>
Subject: Re: Random numbers in tasks
Date: Sat, 31 May 2003 21:42:34 -0600
Date: 2003-05-31T21:42:34-06:00	[thread overview]
Message-ID: <pan.2003.06.01.03.42.32.191321@mail.utexas.edu> (raw)
In-Reply-To: z5dCa.29385$s23.26499@fe07.atl2.webusenet.com

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




  reply	other threads:[~2003-06-01  3:42 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 [this message]
2003-06-01 18:05     ` Papastefanos Serafeim
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