ceorron / cycle-bit-random-number-generator

random cycle bit generator (rcb_generator) - random number generator
MIT License
6 stars 0 forks source link

Code organization #2

Open JoshuaKasa opened 1 year ago

JoshuaKasa commented 1 year ago

Hey, I'm building a PRNG library in C++, I was planning on adding your algorithm but the hard-to-read code makes it really difficult to understand what's going on. If you can, message me on discord: j o s h u a#5172 My usual RNG format is as follows (Sqaures RNG example)

` class Squares { private: ui64 x, y, z;

public: explicit Squares(ui64 seed, ui64 ctr) : y(ctr * seed), x(y), z(y + seed) {}

ui32 generate()
{
    x = x * x + y;
    x = (x >> 32) | (x << 32);
    x = x * x + z;
    x = (x >> 32) | (x << 32);
    x = x * x + y;
    x = (x >> 32) | (x << 32);

    return (x * x + z) >> 32;
}

}; `