00001 namespace SPUC { 00002 // 00003 // Copyright(c) 1993-1996 Tony Kirke 00004 // author="Tony Kirke" * 00005 /* 00006 * SPUC - Signal processing using C++ - A DSP library 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2, or (at your option) 00011 * any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 #ifndef NOISE 00023 #define NOISE 00024 #define M 714025 00025 #define IA 1366 00026 #define IC 150889 00027 #define LM 2147483647 00028 #define LAM (1.0/LM) 00029 #define LA 16807 00030 #define LR 2836 00031 #define LQ 127773 00032 00039 00040 00041 00042 00043 00044 class noise 00045 { 00046 protected: 00047 char s; 00048 double x; 00049 long idum; 00050 00051 public: 00053 noise(double i=1349555.0); // Constructor 00055 double gauss(); 00057 complex<double> Cgauss(void); 00059 double uni(); 00061 double uniform(); 00063 void set_seed(double i=1349555.0) { idum = (long)i;} 00065 void set_seed(unsigned i=1349555) { idum = i;} 00066 } ; 00067 #endif 00068 } // namespace SPUC