Identical random values

Hi all,

I am currently learning how to deal with classes at the moment and am using this tutorial from the wiki page: here

The circles starting x and y positions are set with ofRandom in the constructor. What I was expecting to happen, was each time I ‘build and run’ the program, the ellipses have a fresh set of random starting values. However, although the ellipses starting positions are different from one another, they are the same set of random values every time I run the program.

Can anybody tell me why this is? The ofRandom seems to be behaving almost like randomSeed in Processing, outputting the same random values each time?

I apologise that I may be missing something very simple here, but I couldn’t find a similar post.

Many thanks in advance of your help.

You probably need to seed the random number generator.
So, if you just add ofSeedRandom(); in your setup, it should be ok.