@@ -20,9 +20,9 @@ class ofApp : public ofBaseApp {
2020 ofParameter<size_t > size_ { " size (cube root)" , 25 , 1 , 50 };
2121 ofParameter<unsigned long > seed_ { " seed" , 0 , 0 , 1000 };
2222 ofParameter<void > reinit_ { " re-init engine" };
23- ofParameter<bool > ok_color_ { " ok_color" };
24- ofParameter<float > saturation_ { " saturation" , 0.9 };
25- ofParameter<float > value_ { " value" , .25 };
23+ ofParameter<bool > ok_color_ { " ok_color" , true };
24+ ofParameter<float > saturation_ { " saturation" , 0.95 };
25+ ofParameter<float > value_ { " value" , .45 };
2626 ofParameter<float > offset_ { " offset" , 0 };
2727
2828 size_t col_w_ = 640 ;
@@ -66,74 +66,79 @@ class ofApp : public ofBaseApp {
6666 std::map<std::string, std::shared_ptr<DistGroup>> dists_ {
6767 { " old" ,
6868 std::make_shared<DistGroup>(std::vector<std::shared_ptr<Dist>> {
69-
70- std::make_shared<ConcreteDist< float >>( " rand() " , " old-skool (thread risky) \n based on srand() " , std::nullopt , std::vector<ofAbstractParameter *> { &rand_min_, &rand_max_ },
71- [&] { return ofOldRandom (rand_min_, rand_max_); }) }) },
72-
73- { " core" ,
69+ std::make_shared<ConcreteDist< float >>( " rand() " , " old-skool (thread risky) \n based on srand() " ,
70+ std::nullopt , std::vector<ofAbstractParameter *> { &rand_min_, &rand_max_ },
71+ [&] { return ofOldRandom (rand_min_, rand_max_); })
72+ })
73+ }, { " core" ,
7474 std::make_shared<DistGroup>(std::vector<std::shared_ptr<Dist>> {
75-
76- std::make_shared<ConcreteDist<float >>(" uniform <real>" , " modern, thread safe\n right bound improbable" , " uniform_real_distribution" , std::vector<ofAbstractParameter *> { &uni_min_, &uni_max_ },
77- [&] { return of::random::uniform<float >(uni_min_, uni_max_); }),
78-
79- std::make_shared<ConcreteDist<int >>(
80- " uniform <int>" , " unambiguously\n includes bounds" , " uniform_int_distribution" , std::vector<ofAbstractParameter *> { &uni_int_min_, &uni_int_max_ },
81- [&] { return of::random::uniform<int >(uni_int_min_, uni_int_max_); }, 11 , glm::vec2 { 0 , 10 }, true ),
82-
83- std::make_shared<ConcreteDist<double >>(
84- " normal" , " also aliased to random::gaussian\f or stochastic familiarity" , " normal_distribution" , std::vector<ofAbstractParameter *> { &norm_mean_, &norm_dev_ },
85- [&] { return of::random::normal<double >(norm_mean_, norm_dev_); }, 101 , glm::vec2 { 0 , 200 }),
86-
87- std::make_shared<ConcreteDist<float >>(" exponential" , " all in the title" , " exponential_distribution" , std::vector<ofAbstractParameter *> { &exp_lambda_ },
88- [&] { return of::random::exponential<float >(exp_lambda_); }),
89-
90- std::make_shared<ConcreteDist<int >>(
91- " poisson" , " for sparse, \n positive discrete\n (if mean > 12: ~= normal)" , " poisson_distribution" , std::vector<ofAbstractParameter *> { &poiss_mean_ },
92- [&] { return of::random::poisson<int >(poiss_mean_); }, 21 , glm::vec2 { 0 , 20 }, true ),
93-
75+ std::make_shared<ConcreteDist<float >>(" uniform <real>" , " modern, thread safe\n right bound improbable" , " uniform_real_distribution" ,
76+ std::vector<ofAbstractParameter *> { &uni_min_, &uni_max_ },
77+ [&] { return of::random::uniform<float >(uni_min_, uni_max_); }),
78+
79+ std::make_shared<ConcreteDist<int >>(" uniform <int>" , " unambiguously\n includes bounds" , " uniform_int_distribution" ,
80+ std::vector<ofAbstractParameter *> { &uni_int_min_, &uni_int_max_ },
81+ [&] { return of::random::uniform<int >(uni_int_min_, uni_int_max_); }, 11 , glm::vec2 { 0 , 10 }, true ),
82+
83+ std::make_shared<ConcreteDist<double >>(" normal" , " aliased to random::gaussian\n for stochastic familiarity" , " normal_distribution" ,
84+ std::vector<ofAbstractParameter *> { &norm_mean_, &norm_dev_ },
85+ [&] { return of::random::normal<double >(norm_mean_, norm_dev_); }, 101 , glm::vec2 { 0 , 200 }),
86+
87+ std::make_shared<ConcreteDist<float >>(" exponential" , " all in the title" , " exponential_distribution" ,
88+ std::vector<ofAbstractParameter *> { &exp_lambda_ },
89+ [&] { return of::random::exponential<float >(exp_lambda_); }),
90+
91+ std::make_shared<ConcreteDist<int >>(" poisson" , " for sparse, \n positive discrete\n (if mean > 12: ~= normal)" , " poisson_distribution" ,
92+ std::vector<ofAbstractParameter *> { &poiss_mean_ },
93+ [&] { return of::random::poisson<int >(poiss_mean_); }, 21 , glm::vec2 { 0 , 20 }, true ),
94+
9495 // note int is used here instead of bool because of compiler complaints about "bit values" whatever
95- std::make_shared<ConcreteDist<int >>(
96- " bernoulli" , " binary prob\n e.g. toss of a coin\n aliased to of::random::yes" , " bernoulli_distribution" , std::vector<ofAbstractParameter *> { &yes_ },
97- [&] { return of::random::bernoulli (yes_); }, 2 , glm::vec2 { 0 , 1 }, true ) }) },
98-
99- { " special" ,
96+ std::make_shared<ConcreteDist<int >>(" bernoulli" , " binary prob\n e.g. toss of a coin\n aliased to random::sometimes" , " bernoulli_distribution" ,
97+ std::vector<ofAbstractParameter *> { &yes_ },
98+ [&] { return of::random::bernoulli (yes_); }, 2 , glm::vec2 { 0 , 1 }, true ) })
99+ }, { " special" ,
100100 std::make_shared<DistGroup>(std::vector<std::shared_ptr<Dist>> {
101-
102- std::make_shared<ConcreteDist< int >>(
103- " lognormal " , " like normal but log " , " lognormal_distribution " , std::vector<ofAbstractParameter *> { &log_mean_, &log_dev_ } ,
104- [&] { return of::random::lognormal< int >(log_mean_, log_dev_); }, 21 , glm::vec2 { 0 , 20 }, true ),
105-
106- std::make_shared<ConcreteDist< float >>( " gamma " , " for special purposes " , " gamma_distribution " , std::vector<ofAbstractParameter *> { &gamma_alpha_, &gamma_beta_ },
107- [&] { return of::random::gamma<int >(gamma_alpha_, gamma_beta_); }),
108-
109- std::make_shared<ConcreteDist<float >>(
110- " chi-squared " , " cool energy bulge " , " chi_squared_distribution " , std::vector<ofAbstractParameter *> { &chi_n_ },
111- [&] { return of::random::chi_squared<float >(chi_n_); }, 101 , glm::vec2 { 0 , 20 }),
112-
113- std::make_shared<ConcreteDist<int >>(
114- " binomial " , " ~normal for ints \n squashes nicely on zero " , " binomial_distribution " , std::vector<ofAbstractParameter *> { &bin_p_, &bin_t_ },
115- [&] { return of::random::binomial (bin_p_, bin_t_); }, 21 , glm::vec2 { 0 , 20 }, true ),
116-
117- std::make_shared<ConcreteDist<int >>(
118- " geometric " , " ~expon for sparse ints \n with no parameter " , " geometric_distribution " , std::vector<ofAbstractParameter *> {},
119- [&] { return of::random::geometric<int >(); }, 21 , glm::vec2 { 0 , 20 }, true ) }) },
120-
121- { " of" ,
101+ std::make_shared<ConcreteDist< int >>( " lognormal " , " like normal but log " , " lognormal_distribution " ,
102+ std::vector<ofAbstractParameter *> { &log_mean_, &log_dev_ },
103+ [&] { return of::random::lognormal< int >(log_mean_, log_dev_); }, 21 , glm::vec2 { 0 , 20 }, true ) ,
104+
105+ std::make_shared<ConcreteDist< float >>( " gamma " , " for special purposes " , " gamma_distribution " ,
106+ std::vector<ofAbstractParameter *> { &gamma_alpha_, &gamma_beta_ },
107+ [&] { return of::random::gamma<float >(gamma_alpha_, gamma_beta_); }),
108+
109+ std::make_shared<ConcreteDist<float >>(" chi-squared " , " cool energy bulge " , " chi_squared_distribution " ,
110+ std::vector<ofAbstractParameter *> { &chi_n_ },
111+ [&] { return of::random::chi_squared<float >(chi_n_); }, 101 , glm::vec2 { 0 , 20 }),
112+
113+ std::make_shared<ConcreteDist<int >>(" binomial " , " ~normal for ints \n squashes nicely on zero " , " binomial_distribution " ,
114+ std::vector<ofAbstractParameter *> { &bin_p_, &bin_t_ },
115+ [&] { return of::random::binomial (bin_p_, bin_t_); }, 21 , glm::vec2 { 0 , 20 }, true ),
116+
117+ std::make_shared<ConcreteDist<int >>(" geometric " , " ~expon for sparse ints \n with no parameter " , " geometric_distribution " ,
118+ std::vector<ofAbstractParameter *> {},
119+ [&] { return of::random::geometric<int >(); }, 21 , glm::vec2 { 0 , 20 }, true )
120+ })
121+ }, { " of" ,
122122 std::make_shared<DistGroup>(std::vector<std::shared_ptr<Dist>> {
123-
124- std::make_shared<ConcreteDist<float >>(
125- " bound normal" , " practical min/max\n with enforced limits\n (allows to \" focus\" )\n intuitiver" , " normal_distribution" , std::vector<ofAbstractParameter *> { &bn_min_, &bn_max_, &bn_focus_ }, [&] { return ofRandomBoundNormal<int >(bn_min_, bn_max_, bn_focus_); }, 101 , glm::vec2 { 0 , 200 }),
126-
127- std::make_shared<ConcreteDist<glm::vec2>>(
128- " vec2 uniform/axis" , " all generators can\n be typed vec2, 3 or 4" , " uniform_int_distribution" , std::vector<ofAbstractParameter *> { &vec_min_, &vec_max_ }, [&] { return of::random::uniform<glm::vec2>(vec_min_, vec_max_); }, 101 , glm::vec2 { 0 , 200 }),
129-
130- std::make_shared<ConcreteDist<glm::vec2>>(
131- " vec2 normal/axis" , " vecN version can be\n refined to vecN axis" , " normal_distribution" , std::vector<ofAbstractParameter *> { &vec_mean_, &vec_dev_ }, [&] { return of::random::gaussian<glm::vec2>(vec_mean_, vec_dev_); }, 101 , glm::vec2 { 0 , 200 }),
132-
133- std::make_shared<ConcreteDist<glm::vec3>>(
134- " vec3 gamma" , " " , " gamma_distribution" , std::vector<ofAbstractParameter *> { &vec_gamma_a_, &vec_gamma_b_ }, [&] { return of::random::gamma<glm::vec3>(vec_gamma_a_, vec_gamma_b_); }, 101 , glm::vec2 { 0 , 200 }) }) }
123+ std::make_shared<ConcreteDist<float >>(" bound normal" , " practical min/max\n with enforced limits\n (allows to \" focus\" )\n intuitiver" , " normal_distribution" ,
124+ std::vector<ofAbstractParameter *> { &bn_min_, &bn_max_, &bn_focus_ },
125+ [&] { return ofRandomBoundNormal<float >(bn_min_, bn_max_, bn_focus_); }, 101 , glm::vec2 { 0 , 200 }),
126+
127+ std::make_shared<ConcreteDist<glm::vec2>>(" vec2 uniform/axis" , " all generators can\n be typed vec2, 3 or 4" , " uniform_int_distribution" ,
128+ std::vector<ofAbstractParameter *> { &vec_min_, &vec_max_ },
129+ [&] { return of::random::uniform<glm::vec2>(vec_min_, vec_max_); }, 101 , glm::vec2 { 0 , 200 }),
130+
131+ std::make_shared<ConcreteDist<glm::vec2>>(" vec2 normal/axis" , " vecN version can be\n refined to vecN axis" , " normal_distribution" ,
132+ std::vector<ofAbstractParameter *> { &vec_mean_, &vec_dev_ },
133+ [&] { return of::random::gaussian<glm::vec2>(vec_mean_, vec_dev_); }, 101 , glm::vec2 { 0 , 200 }),
134+
135+ std::make_shared<ConcreteDist<glm::vec3>>(" vec3 gamma" , " " , " gamma_distribution" ,
136+ std::vector<ofAbstractParameter *> { &vec_gamma_a_, &vec_gamma_b_ },
137+ [&] { return of::random::gamma<glm::vec3>(vec_gamma_a_, vec_gamma_b_); }, 101 , glm::vec2 { 0 , 200 })
138+ })
139+ }
135140 };
136-
141+
137142public:
138143 auto rebuild_signatures () {
139144 dna_string_ = " 1. first 8 numbers: " ;
0 commit comments