summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/math/random.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/lib/math/random.cc')
-rw-r--r--gnuradio-runtime/lib/math/random.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/gnuradio-runtime/lib/math/random.cc b/gnuradio-runtime/lib/math/random.cc
index af90a33429..cedaf4b97f 100644
--- a/gnuradio-runtime/lib/math/random.cc
+++ b/gnuradio-runtime/lib/math/random.cc
@@ -141,11 +141,12 @@ namespace gr {
float
random::laplacian()
{
- float z = ran1()-0.5;
- if(z>0) return -logf(1-2*z);
- else return logf(1+2*z);
+ float z = ran1();
+ if (z > 0.5f){
+ return -logf(2.0f * (1.0f - z) );
+ }
+ return logf(2 * z);
}
-
/*
* Copied from The KC7WW / OH2BNS Channel Simulator
* FIXME Need to check how good this is at some point