Tweaks to fmopl; same net effect overall, just faster.
Eliminate divisions, floating point, and mod operation from inner synth loop. svn-id: r30896
This commit is contained in:
parent
5b31fe75d4
commit
890bca8f7e
3 changed files with 37 additions and 20 deletions
|
@ -196,6 +196,12 @@ uint RandomSource::getRandomNumber(uint max) {
|
|||
return _randSeed % (max + 1);
|
||||
}
|
||||
|
||||
uint RandomSource::getRandomBit(void) {
|
||||
_randSeed = 0xDEADBF03 * (_randSeed + 1);
|
||||
_randSeed = (_randSeed >> 13) | (_randSeed << 19);
|
||||
return _randSeed & 1;
|
||||
}
|
||||
|
||||
uint RandomSource::getRandomNumberRng(uint min, uint max) {
|
||||
return getRandomNumber(max - min) + min;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue