[Newbies] Randomness

Levente Uzonyi leves at elte.hu
Tue Apr 5 00:08:35 UTC 2011


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.


Levente

>
> Michael
>


More information about the Beginners mailing list