[MUD-Dev] Rooms, 3D arrays, etc.

Jeff Kesselman jeffk at tenetwork.com
Thu Jun 5 22:03:16 New Zealand Standard Time 1997


At 07:41 PM 6/5/97 PST8PDT, jc lawrence wrote:
>In <199706050211.VAA10068 at dfw-ix15.ix.netcom.com>, on 06/04/97 
>   at 08:34 PM, "Jon A. Lambert" <jlsysinc at ix.netcom.com> said:
>
>>Does multi-threading have any affects on seeds used in the random
>>generator.  Does anyone know if this is truly thread safe?
>
>Yes and no.  
>
>Look at the random number algorithms in something like Numerical
>Recipes.  Many random number algorithms work by getting the next value
>by computing on that last value returned and possibly some earlier
>ones than that.  sometimes this is also crossed with a timer value
>either as an initial seed, or as an ongoing affair.

Ah, this is assuming you are creating a series not a single number. Easy
enough to solve, just reseed yourslef with the last numebr before calling
again and do both the reseed and the call ina  critical section.

There is NOTHING that can be doen in monothreaded code that cannot be amde
to work multi-trheaded if you understand what youa re doing.

>
>More interesting for the current fractal landscape discussion is
>repeatability.  We don't really want random values.  We want values
>that viewed as a set appear random, but can be re-computed from a
>basic algorithm to get an identical set of values.  (That rules out
>any of the timer absed seeds.)  

Yep, and the whoel poitn of discussing psuedo randoms was that theya re
repeatable given the same seed.  The logical seed for thsi application,as
someone mentioend, is some procedural calculated numeb based on the coords
of the point in question.  100% repeatable. 

>The standard approach is to make private rand() functions for each
>feature.  This has the benefit of allowing the choice of algorithm for
>each rand() function to be tailored to the task.  The problem is that

Icky.  yech.  Duplicate code??? Why, when the only issue is a single peice
of data.  just start from a known seed and always reseed when you call.
Problem solved with one variable local to obejct in question.  Again, if
this is based on a variable you already store, you dont even need that.

I fidn this discussion a touch ironic.  Typicly the question is how to
AVOID the obviosu repeating nature of psuedo randoms-- thus the timer tick
dodge.

No offesne guys, but I thin kyour making this WAY harder then it needs to be.

JK




More information about the MUD-Dev mailing list