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 14:31:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc52.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Random numbers in tasks References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc52.ops.asp.att.net 1054503115 12.234.13.56 (Sun, 01 Jun 2003 21:31:55 GMT) NNTP-Posting-Date: Sun, 01 Jun 2003 21:31:55 GMT Organization: AT&T Broadband Date: Sun, 01 Jun 2003 21:31:55 GMT Xref: archiver1.google.com comp.lang.ada:38295 Date: 2003-06-01T21:31:55+00:00 List-Id: >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.