Improve lmms::fastRand() and use it instead of std::rand()#7741
Improve lmms::fastRand() and use it instead of std::rand()#7741rubiefawn merged 36 commits intoLMMS:masterfrom
Conversation
messmerd
left a comment
There was a problem hiding this comment.
I haven't reviewed everything yet, but here's what I have so far
Also Github's diff viewer is cursed and I am now filled with distrust towards it
|
Briefly tested Mallets, Spectrum Analyzer, ReverbSC, Flanger and Ogranic. I think we can (finally) merge! 🎉 |
szeli1
left a comment
There was a problem hiding this comment.
I'm changing my approval in light of std::nearbyint.
Out of scope, these belong on a different branch
regulus79
left a comment
There was a problem hiding this comment.
I was asked to review this PR; I have looked through all the code, and the changes appear fine to me. I am not an expert in pseudorandom number generation, but assuming people have tested it, I think it's fine.
|
Now that this has an approval from a dev with write access, I plan to merge this PR on 2026-01-08, provided no issues are found in the meantime. If anyone else would like to review this PR, please do so before that date. |
messmerd
left a comment
There was a problem hiding this comment.
Quick review - haven't looked at things too closely yet
oopsie daisy Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Also use "upper" instead of "range" for fastRand(x) functions, since the lone parameter is not itself a range, but rather the upper limit of one. Today I learned that I do not know how to spell "pseudorandom" lmao
Didn't know you could just put em in the angle brackets lol, neat
By popular demand!
lmms::fastRand()into one templateRAND_MAXconstant since it is not used outsidelmms::fastRand()(and all places that did previously use it should have been callinglmms::fastRand()anyway)lmms::fastLog10f()for consistency, though it is not related to the goal of the PRlmms::oneIn()convenience function to replace occurences of(fastRand() % chance == 0)std::rand()withlmms::fastRand()for consistencyscale * lmms::fastRand() / RAND_MAX - offsetwithlmms::fastRand(min, max)Testing
.dssamples with noise sound the same