diff options
Diffstat (limited to 'gnuradio-core/src/lib/general/gr_random.cc')
-rw-r--r-- | gnuradio-core/src/lib/general/gr_random.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/gnuradio-core/src/lib/general/gr_random.cc b/gnuradio-core/src/lib/general/gr_random.cc index 52140acc27..323839acc7 100644 --- a/gnuradio-core/src/lib/general/gr_random.cc +++ b/gnuradio-core/src/lib/general/gr_random.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2002 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -22,7 +22,7 @@ /* * Copyright 1997 Massachusetts Institute of Technology - * + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that @@ -32,7 +32,7 @@ * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. - * + * */ #ifdef HAVE_CONFIG_H @@ -76,18 +76,18 @@ float gr_random::ran1() int j; long k; float temp; - + if (d_seed <= 0 || !d_iy) { - if (-d_seed < 1) + if (-d_seed < 1) d_seed=1; - else + else d_seed = -d_seed; for (j=NTAB+7;j>=0;j--) { k=d_seed/IQ; d_seed=IA*(d_seed-k*IQ)-IR*k; - if (d_seed < 0) + if (d_seed < 0) d_seed += IM; - if (j < NTAB) + if (j < NTAB) d_iv[j] = d_seed; } d_iy=d_iv[0]; @@ -150,16 +150,16 @@ float gr_random::laplacian() float gr_random::impulse(float factor = 5) { float z = -M_SQRT2 * log(ran1()); - if (fabsf(z) <= factor) + if (fabsf(z) <= factor) return 0.0; - else + else return z; } /* * Complex rayleigh is really gaussian I and gaussian Q * It can also be generated by real rayleigh magnitude and - * uniform random angle + * uniform random angle * Adapted from The KC7WW / OH2BNS Channel Simulator * FIXME Need to check how good this is at some point */ |