1997Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Rooms, 3D arrays, etc. -->
<!--X-From-R13: pynjerapNphc.uc.pbz -->
<!--X-Date: from stimpy.globecomm.net [207.51.48.4] by in12.ibm.net id 865537728.27188&#45;1 Thu Jun  5 19:08:48 1997 CUT -->
<!--X-Message-Id: 199706051906.MAA03945#xsvr3,cup.hp.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199706050211.VAA10068@dfw&#45;ix15.ix.netcom.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Rooms, 3D arrays, etc.</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:clawrenc#cup,hp.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg01201.html">Previous</a>
&nbsp;|&nbsp;<a href="msg01206.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg01195.html">Previous</a>
&nbsp;|&nbsp;<a href="msg01248.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#01203">Author</A>
&nbsp;|&nbsp;<A HREF="#01203">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#01203">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Rooms, 3D arrays, etc.</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Rooms, 3D arrays, etc.</LI>
<LI><em>From</em>: <A HREF="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</A></LI>
<LI><em>Date</em>: Thu, 05 Jun 97 11:28:42 -0700</LI>
<LI><em>Reply-to</em>: <A HREF="mailto:claw#null,net">claw#null,net</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
In &lt;<A HREF="msg01166.html">199706050211.VAA10068#dfw-ix15,ix.netcom.com</A>&gt;, on 06/04/97 
   at 08:34 PM, "Jon A. Lambert" &lt;jlsysinc#ix,netcom.com&gt; said:

&gt;Does multi-threading have any affects on seeds used in the random
&gt;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.

There are obvious MT problems here, the most glaring being the race
condition with on the last returned value for the next value
computation.

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.)  Given an MT safe random number
function we have an extra constraint here in that given a certain
seed, rand() as called by the landscape code must ALWAYS generate the
same sequence of values, despite the fact that the fight code, spell
code etc amy also be calling rand() in other threads, quite possibly
with different seed values.

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
it does not solve the problem if your feature may be called from
multiple threads (eg multiple threads querying/generating your
landscape).  Next up is to use per-feature specific rand() functions
and then add some sort of rand() context to each thread (cf rand
object) which guarantees the sequence.  

-- 
J C Lawrence                           Internet: claw#null,net
(Contractor)                           Internet: coder#ibm,net
---------------(*)               Internet: clawrenc#cup,hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="01248" HREF="msg01248.html">Physical Space Representation</A></strong>
<ul compact><li><em>From:</em> mathue#king,cts.com (Mathue Moyer)</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="01166" HREF="msg01166.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></STRONG>
<UL><LI><EM>From:</EM> "Jon A. Lambert" &lt;jlsysinc#ix,netcom.com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg01201.html">Re: [MUD-Dev] RP=MUSH/PG=MUD</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg01206.html">Re: [MUD-Dev] Combat and Roleplay</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg01195.html">Re: [MUD-Dev] Threaded rand()</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg01248.html">Physical Space Representation</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#01203"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#01203"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] Rooms, 3D arrays, etc.</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="01146" HREF="msg01146.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Miroslav Silovic <a href="mailto:silovic#srce,hr">silovic#srce,hr</a>, Wed 04 Jun 1997, 15:59 GMT
</LI>
</ul>
</ul>
<LI><strong><A NAME="01073" HREF="msg01073.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 03 Jun 1997, 08:14 GMT
</LI>
<LI><strong><A NAME="01166" HREF="msg01166.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Thu 05 Jun 1997, 09:11 GMT
<UL>
<LI><strong><A NAME="01195" HREF="msg01195.html">Re: [MUD-Dev] Threaded rand()</A></strong>, 
Ling <a href="mailto:K.L.Lo-94#student,lut.ac.uk">K.L.Lo-94#student,lut.ac.uk</a>, Thu 05 Jun 1997, 22:36 GMT
</LI>
<LI><strong><A NAME="01203" HREF="msg01203.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Fri 06 Jun 1997, 02:08 GMT
<UL>
<LI><strong><A NAME="01248" HREF="msg01248.html">Physical Space Representation</A></strong>, 
Mathue Moyer <a href="mailto:mathue#king,cts.com">mathue#king,cts.com</a>, Sun 08 Jun 1997, 02:17 GMT
<UL>
<LI><strong><A NAME="01285" HREF="msg01285.html">Re: [MUD-Dev]  Physical Space Representation</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Wed 11 Jun 1997, 10:08 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="01190" HREF="msg01190.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Thu 05 Jun 1997, 12:51 GMT
</LI>
<LI><strong><A NAME="01202" HREF="msg01202.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 05 Jun 1997, 21:47 GMT
</LI>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>