1 // This may look like C code, but it is really -*- C++ -*- 2 /* 3 Copyright (C) 1988 Free Software Foundation 4 written by Dirk Grunwald (grunwald@cs.uiuc.edu) 5 6 This file is part of GNU CC. 7 8 GNU CC is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY. No author or distributor 10 accepts responsibility to anyone for the consequences of using it 11 or for whether it serves any particular purpose or works at all, 12 unless he says so in writing. Refer to the GNU CC General Public 13 License for full details. 14 15 Everyone is granted permission to copy, modify and redistribute 16 GNU CC, but only under the conditions described in the 17 GNU CC General Public License. A copy of this license is 18 supposed to have been given to you along with GNU CC so you 19 can know your rights and responsibilities. It should be in a 20 file named COPYING. Among other things, the copyright notice 21 and this notice must be preserved on all copies. 22 */ 23 #ifndef _Random_h 24 #ifdef __GNUG__ 25 #pragma once 26 #pragma interface 27 #endif 28 #define _Random_h 1 29 #ifdef __GNUG__ 30 #pragma once 31 #pragma interface 32 #endif 33 34 #include <math.h> 35 #include "RNG.h" 36 37 class Random { 38 protected: 39 RNG *pGenerator; 40 public: 41 Random(RNG *generator); 42 virtual double operator()() = 0; 43 44 RNG *generator(); 45 void generator(RNG *p); 46 }; 47 48 #if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) 49 Random(RNG * gen)50inline Random::Random(RNG *gen) 51 { 52 pGenerator = gen; 53 } 54 generator()55inline RNG *Random::generator() 56 { 57 return(pGenerator); 58 } 59 generator(RNG * p)60inline void Random::generator(RNG *p) 61 { 62 pGenerator = p; 63 } 64 65 #endif 66 67 #endif 68