comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Random numbers in tasks
Date: Sun, 01 Jun 2003 21:31:55 GMT
Date: 2003-06-01T21:31:55+00:00	[thread overview]
Message-ID: <fhuCa.11873$DV.10919@rwcrnsc52.ops.asp.att.net> (raw)
In-Reply-To: bbdmsr$brr$1@ulysses.noc.ntua.gr

>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...
  Just create a protected type to serialize calls from that function
(which presumably could be called simultaneously by multiple tasks)
to the random number generator.  If you need reproducability, and
the timing of various tasks' calls for a random number is variable,
then you've got a problem.  But if your function doesn't know who
called it, clearly it can't give numbers from a caller-specific
generator.

>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 ?
  If your output is direct to a screen array, each task can
have its own piece of real estate that everyone else stays out of.
If your output is by strings, multiple tasks could result in
funny merges of their output strings.  In that case, a protected
type is again the simple solution.



  reply	other threads:[~2003-06-01 21:31 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 [this message]
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