Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gr_random.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2002 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 /*
00024  *  Copyright 1997 Massachusetts Institute of Technology
00025  * 
00026  *  Permission to use, copy, modify, distribute, and sell this software and its
00027  *  documentation for any purpose is hereby granted without fee, provided that
00028  *  the above copyright notice appear in all copies and that both that
00029  *  copyright notice and this permission notice appear in supporting
00030  *  documentation, and that the name of M.I.T. not be used in advertising or
00031  *  publicity pertaining to distribution of the software without specific,
00032  *  written prior permission.  M.I.T. makes no representations about the
00033  *  suitability of this software for any purpose.  It is provided "as is"
00034  *  without express or implied warranty.
00035  * 
00036  */
00037 
00038 
00039 #ifndef _GR_RANDOM_H_
00040 #define _GR_RANDOM_H_
00041 
00042 #include <VrComplex.h>
00043 
00044 #define IA 16807
00045 #define IM 2147483647
00046 #define AM (1.0/IM)
00047 #define IQ 127773
00048 #define IR 2836
00049 #define NTAB 32
00050 #define NDIV (1+(IM-1)/NTAB)
00051 #define EPS 1.2e-7
00052 #define RNMX (1.0-EPS)
00053 
00054 class gr_random {
00055 protected:
00056   long  seed;
00057   int   iset;
00058   float gset;
00059   
00060 public: 
00061   void reseed(int newseed) { seed=newseed; };
00062   float ran1();
00063   float gasdev();
00064   float laplacian();
00065   float impulse(float factor);
00066   float rayleigh();
00067   VrComplex rayleigh_complex();
00068   gr_random(int seed=3021) : seed(seed),iset(0) {};
00069 };
00070 
00071 
00072 #endif

Generated on Tue Mar 15 23:48:04 2005 for GNU Radio by  doxygen 1.4.0