ofRandom vs ofNoise


My first question in here :smile:

What is the main difference between noise and randomness?
I’ve noticed that the documentation isn’t completely done in some of the places, is where is the best place to learn little things like this?


For an ample answer to this question, I highly recommend you read the Introduction of Dan Shiffman’s “The Nature of Code”. The author made very good examples in Processing to demonstrate many kinds of “randomness”.

Here’s the link: http://natureofcode.com/book/introduction/


1 Like

@daragao, a good place to look for this specific question would be at some of Daniel Shiffman’s descriptions. See the introduction of The Nature of Code - specifically section I.6 - or if you want to see him talk about it, check out his video on the topic. He’s talking about Processing, so the syntax is a little different, but the concept is the same.

As far as other questions go, it all depends on the question. Answers to questions about C++ are often a google search away. Some openFrameworks topics are covered by the tutorials on the site. Other topics - like this one - are general concepts that have been written up elsewhere on the web. Wish there were a more centralized source, but a google search combined with a search of the forum is a good start. And then, of course, posting here.

Hah - guess we were thinking of the same thing, though you happened to think a bit faster than I did :slight_smile:

Thanks guys, sorry for the late reply, I didn’t comeback to check the answer, but that was actually what I did :wink:

1 Like

on thing to consider is that noise a “deterministic” function, which means it returns the same thing with the same input, the way, for example, sin(0.2) always returns the same thing. random is non deterministic (unless you seed the random number generator) so it returns different results with the same inputs. In this way, noise is much more like a pure mathematical function (f(x)=y)…

For me, the most simple and direct way to understand the difference between them is that you draw two circles in of, one circle’s radius is controlled by ofRandom while the other circle’s radius is controlled by ofNoise. The visual difference is quite obvious.

some code like this:

float noise=ofNoise(ofGetElapsedTimef());
float random=ofRandom(1);
ofCircle(ofGetWidth()/4, ofGetHeight()/2, 200*noise);
ofCircle(ofGetWidth()*0.75, ofGetHeight()/2, 200*random);