lemur
lemur copied to clipboard
Random library
I was going to implement this, but I don't know of a good PRNG that doesn't need bitmath, and I'm not entirely comfortable making a bit library a dependency.
Since relying on randomness in a test is probably not a great idea, we could always make it return a constant value as a shim, or expose the API but make everything throw an error.
I don't like making everything error, I have some code I'd like to test that uses Random in their initialization but are otherwise consistent and testable. I propose just picking the middle of the two values provided (defaulting to 0 and 1 for NextNumber).
Because you can have a predictable seed in Roblox for Random
(and you can rely on that sequence), it'd probably be inappropriate for Lemur to implement a different strategy, now that I think about it more.
So what are you suggesting? Mirroring XSH-RR PCG with the exact same constants as Roblox?
I think supporting this in Lemur would probably involve writing a LuaRocks rock that implements the same RNG as Roblox (right, PCG) in C/C++ and then adding it as an optional dependency for Lemur.
The algorithm Roblox uses has magic constants, so that's something you or another engineer would have to acquire (I'm not interested in breaking the ToS and reverse engineering the exe, much less complicated bitmath 😋)