summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-03-31 21:50:28 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-03-31 21:50:28 +0200
commit2e4175d84cc0ca765fdc0b03bf5c8420deeec268 (patch)
tree336b952087d87fc69f69dd0bfcfb245bc4864c49 /src
parentf0fdd378622aefe6f5132bc9231447073956041a (diff)
Use new Random class.
Diffstat (limited to 'src')
-rw-r--r--src/instrument.cc10
1 files 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 <cstdlib>
-//#include <stdio.h>
-
#include <hugin.hpp>
#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<Sample*>(s);
}
if(enable_velocity_modifier)