Sunday, February 06, 2011 3:09 PM
While skimming the book of Shoo I came across the first plot example:
>> y = rand(30)
Imagine my surprise when I got the exact figure in the book! By repeating it a few times, it is obvious that Sho starts the randomiser at the same seed every time. I would personally regard that as a bug. What's your opinion?
Friday, February 11, 2011 4:26 PMModerator
Hi Muhammad, thanks for your question; this is actually an intentional behavior. When doing experiments with random settings, it's important for trials to be repeatable. Since we always start with the same seed, you're guaranteed to get the same results every time.
If you do want to set the seed to a new value, you can set sho.RandomFactory.Seed to a unique number; if you want to set it automatically you can use the time, i.e.:
>>> sho.RandomFactory.Seed = System.DateTime.Now.Ticks % 65535
There are a variety of issues to using time (or some other heuristic) as a seed, though; for instance, if two instances of your experiment start at the same time on two machines, you could end up with the same values. In general, it's best to choose your seeds via some known scheme and keep track of them; that way you can have full repeatability for your experiments.