Skip to content

Commit

Permalink
Use fast_rand()
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Sep 28, 2023
1 parent 33619e3 commit 136e4b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/Stk/Mallets/Mallets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,18 @@ void MalletsInstrument::playNote( NotePlayHandle * _n,

if(p < 9)
{
hardness += random * static_cast<float>(rand() % 128) - 64.0;
hardness += random * static_cast<float>(fast_rand() % 128) - 64.0;
hardness = std::clamp(0.0f, hardness, 128.0f);

position += random * static_cast<float>(rand() % 64) - 32.0;
position += random * static_cast<float>(fast_rand() % 64) - 32.0;
position = std::clamp(0.0f, position, 64.0f);
}
else if(p == 9)
{
modulator += random * static_cast<float>(rand() % 128) - 64.0;
modulator += random * static_cast<float>(fast_rand() % 128) - 64.0;
modulator = std::clamp(0.0f, modulator, 128.0f);

crossfade += random * static_cast<float>(rand() % 128) - 64.0;
crossfade += random * static_cast<float>(fast_rand() % 128) - 64.0;
crossfade = std::clamp(0.0f, crossfade, 128.0f);
}

Expand Down

0 comments on commit 136e4b9

Please sign in to comment.