chugins icon indicating copy to clipboard operation
chugins copied to clipboard

chuck 1.4.2 appears to have broken Spectacle and Multicomb (RNG)

Open dbadb opened this issue 1 year ago • 1 comments

chuck 1.4.2 appears to have broken Spectacle and Multicomb (RNG) by undefining RAND_MAX.

Seems like an opportunity to modernize and decouple. Both chugins want a rand2f function. Here's a simple+modern+portable one.

#include <random>
float rand2f (float min, float max)
{
    static std::mt19937 s_mt;
    static std::uniform_real_distribution<float> s_dist(0.f, 1.f);
    float x = s_dist(s_mt);
    return min + x * (max - min);
}

dbadb avatar Jan 08 '23 00:01 dbadb

looking into this (@celestebetancur @nshaheed @gewang) we believe this is indeed due to rand2f using both ::random() and CK_RANDOM_MAX; the latter is determined by platform and may be inconsistent with ::random(); we plan to fix this post chuck-1.5, where we have a number of chugin evolutions on the roadmap.

gewang avatar May 16 '23 04:05 gewang