Is there any Gaussian random generator in ofx? I couldn’t find any.
I am currently using an add-on, but i would prefer to use a built-in function (or maybe an inline function in my testApp), because this code of for porting Daniel Shiffman’s Nature of Code to ofx (I am trying to maintain as little dependencies as possible in the code).
(we will be posting the code as we advance in https://github.com/tecnecollective/The-Nature-of-Code-Examples)
an issue has existed for quite some time. i intend to do it, but haven’t gotten around to it yet: https://github.com/openframeworks/openFrameworks/issues/224
you could use the code in there for now, and adapt as soon as this gets added to OF?
I know this thread is quite old. But I stumbled across this today whilst also trying to follow Daniel Shiffman’s “Nature of Code” in OF.
Since C++11 there is a Normal Distribution function in the standard library std::normal_distribution in “random.h” this can be used to build your own function, here’s the one I made:
float NextGaussian(const float center, const float standard_dev)
std::normal_distribution<float> distribution(center, standard_dev);
float NextReal(const float lower, const float upper)
std::uniform_real_distribution<float> distribution(lower, upper);