From: "Bobby D. Bryant" <bdbryant@mail.utexas.edu>
Subject: Re: Random numbers in tasks
Date: Sun, 01 Jun 2003 23:32:56 -0600
Date: 2003-06-01T23:32:56-06:00 [thread overview]
Message-ID: <pan.2003.06.02.05.32.53.764840@mail.utexas.edu> (raw)
In-Reply-To: 3EDAC482.40604@attbi.com
On Mon, 02 Jun 2003 03:29:33 +0000, Robert I. Eachus wrote:
> Papastefanos Serafeim wrote:
>> 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...
>
> There is magic in Ada for especially this purpose. It is in Annex C, so
> it is possible that some compilers don't support it. Look at C.7.2 The
> Package Task_Attributes. Here is an example and output using GNAT.
> Notice that this version uses a fixed seed for each different task. If
> you want different seeds for every run modify the body of
> My_Float_Random.Gen_Source. But notice that just using a call to get
> seeds based on the clock may not be sufficient, unless you put a delay
> in.
FWIW, I have a GA solver with similar requirements, and I just have the
tasks rendezvous with a 'controller' task that dispenses individual seeds
for them to initialize on. After that they can run independently.
--
Bobby Bryant
Austin, Texas
next prev parent reply other threads:[~2003-06-02 5:32 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
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 [this message]
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