<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thanks again. I'll just modify the seed each time, before I load the project, and get different results that way.<br><br>Michael<br><br>--- On <b>Mon, 4/4/11, Levente Uzonyi <i>&lt;leves@elte.hu&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Levente Uzonyi &lt;leves@elte.hu&gt;<br>Subject: Re: [Newbies] Randomness<br>To: "A friendly place to get answers to even the most basic questions about Squeak." &lt;beginners@lists.squeakfoundation.org&gt;<br>Date: Monday, April 4, 2011, 8:32 PM<br><br><div class="plainMail">On Mon, 4 Apr 2011, michael rice wrote:<br><br>&gt; I forgot to mention, I'm using the random number tile and scripting. Does that make it more difficult?<br><br>Not really, RandomNumberTile uses the global random number generator of Collection. I don't know how/why is
 it serialized/restored, but here's a method which should help:<br><br>RandomNumberTile &gt;&gt; #comeFullyUpOnReload: smartRefStream<br><br>&nbsp;&nbsp;&nbsp; | seed |<br>&nbsp;&nbsp;&nbsp; [<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; seed := (Time millisecondClockValue bitAnd: 16r3FFFFFFF) bitXor: self hash.<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; seed := seed bitXor: (Time totalSeconds bitAnd: 16r3FFFFFFF).<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; seed := seed bitXor: 16r3FFFFFFF atRandom.<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; seed = 0 ] whileTrue. "Try again if ever get a seed = 0"<br>&nbsp;&nbsp;&nbsp; Collection mutexForPicking critical: [<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Collection randomForPicking seed: seed ].<br>&nbsp;&nbsp;&nbsp; ^super comeFullyUpOnReload: smartRefStream<br><br>It's drawback is that it will reseed the rng for every RandomNumberTile. The best solution would be if Etoys would use a custom Random instance or a subclass
 where this is done by default.<br><br><br>Levente<br><br>&gt; <br>&gt; Michael<br>&gt; <br>&gt; --- On Mon, 4/4/11, Levente Uzonyi &lt;<a ymailto="mailto:leves@elte.hu" href="/mc/compose?to=leves@elte.hu">leves@elte.hu</a>&gt; wrote:<br>&gt; <br>&gt; From: Levente Uzonyi &lt;<a ymailto="mailto:leves@elte.hu" href="/mc/compose?to=leves@elte.hu">leves@elte.hu</a>&gt;<br>&gt; Subject: Re: [Newbies] Randomness<br>&gt; To: "A friendly place to get answers to even the most basic questions about Squeak." &lt;<a ymailto="mailto:beginners@lists.squeakfoundation.org" href="/mc/compose?to=beginners@lists.squeakfoundation.org">beginners@lists.squeakfoundation.org</a>&gt;<br>&gt; Date: Monday, April 4, 2011, 8:08 PM<br>&gt; <br>&gt; On Mon, 4 Apr 2011, michael rice wrote:<br>&gt; <br>&gt;&gt; I just noticed that when I load a morphic project I get the same stream of random numbers each time. Is there a simple way to install a new different random seed each time the
 project is loaded?<br>&gt; <br>&gt; If you serialize the Random object, then it will have the same state when it's restored. I guess you should create a subclass of Random, which implements #comeFullyUpOnReload:. That method can reinitialize the seed of the random number generator. You may want to check UUIDGenerator &gt;&gt; #makeSeed if you don't know how to get a good seed for your rng.<br>&gt; <br>&gt; <br>&gt; Levente<br>&gt; <br>&gt;&gt; <br>&gt;&gt; Michael<br>&gt;&gt; <br>&gt; _______________________________________________<br>&gt; Beginners mailing list<br>&gt; <a ymailto="mailto:Beginners@lists.squeakfoundation.org" href="/mc/compose?to=Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>&gt; <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>&gt; <br>_______________________________________________<br>Beginners
 mailing list<br><a ymailto="mailto:Beginners@lists.squeakfoundation.org" href="/mc/compose?to=Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br></div></blockquote></td></tr></table>