From 2e4175d84cc0ca765fdc0b03bf5c8420deeec268 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 31 Mar 2016 21:50:28 +0200 Subject: Use new Random class. --- src/instrument.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/instrument.cc b/src/instrument.cc index d246c09..ee225d5 100644 --- a/src/instrument.cc +++ b/src/instrument.cc @@ -26,9 +26,6 @@ */ #include "instrument.h" -#include -//#include - #include #include "sample.h" @@ -82,8 +79,7 @@ Sample* Instrument::sample(level_t level, size_t pos) if(enable_velocity_randomiser) { - float r = (float)rand() / (float)RAND_MAX; // random number: [0;1] - r -= 0.5; // random number [-0.5;0.5] + float r = rand.floatInRange(-0.5f, 0.5f); r *= velocity_randomiser_weight * 2; // ex. random number [-0.1;0.1] level += r; if(level > 1.0) @@ -121,8 +117,8 @@ Sample* Instrument::sample(level_t level, size_t pos) return NULL; } - size_t idx = rand()%(s.size()); - sample = s[idx]; + //size_t idx = ::rand()%(s.size()); + sample = rand.choose(s); } if(enable_velocity_modifier) -- cgit v1.2.3