[Newbies] Randomness

michael rice nowgate at yahoo.com
Tue Apr 5 00:17:41 UTC 2011

I forgot to mention, I'm using the random number tile and scripting. Does that make it more difficult?


--- On Mon, 4/4/11, Levente Uzonyi <leves at elte.hu> wrote:

From: Levente Uzonyi <leves at elte.hu>
Subject: Re: [Newbies] Randomness
To: "A friendly place to get answers to even the most basic questions about Squeak." <beginners at lists.squeakfoundation.org>
Date: Monday, April 4, 2011, 8:08 PM

On Mon, 4 Apr 2011, michael rice wrote:

> 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?

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 >> #makeSeed if you don't know how to get a good seed for your rng.


> Michael
Beginners mailing list
Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20110404/6dd26a39/attachment.htm

More information about the Beginners mailing list