home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / lib270b.zip / emx / include / cpp / Random.h < prev    next >
C/C++ Source or Header  |  1995-06-16  |  1KB  |  55 lines

  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 the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #ifndef _Random_h
  19. #define _Random_h 1
  20. #ifdef __GNUG__
  21. #pragma interface
  22. #endif
  23.  
  24. #include <math.h>
  25. #include <RNG.h>
  26.  
  27. class Random {
  28. protected:
  29.     RNG *pGenerator;
  30. public:
  31.     Random(RNG *generator);
  32.     virtual double operator()() = 0;
  33.  
  34.     RNG *generator();
  35.     void generator(RNG *p);
  36. };
  37.  
  38.  
  39. inline Random::Random(RNG *gen)
  40. {
  41.     pGenerator = gen;
  42. }
  43.  
  44. inline RNG *Random::generator()
  45. {
  46.     return(pGenerator);
  47. }
  48.  
  49. inline void Random::generator(RNG *p)
  50. {
  51.     pGenerator = p;
  52. }
  53.  
  54. #endif
  55.