| 1 | /*************************************************************************** | 
|---|
| 2 | * blitz/random.h       Random number generator wrapper class | 
|---|
| 3 | * | 
|---|
| 4 | * $Id: random.h,v 1.1.1.1 1999-04-09 17:58:59 ansari Exp $ | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca> | 
|---|
| 7 | * | 
|---|
| 8 | * This program is free software; you can redistribute it and/or | 
|---|
| 9 | * modify it under the terms of the GNU General Public License | 
|---|
| 10 | * as published by the Free Software Foundation; either version 2 | 
|---|
| 11 | * of the License, or (at your option) any later version. | 
|---|
| 12 | * | 
|---|
| 13 | * This program is distributed in the hope that it will be useful, | 
|---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 16 | * GNU General Public License for more details. | 
|---|
| 17 | * | 
|---|
| 18 | * Suggestions:          blitz-suggest@cybervision.com | 
|---|
| 19 | * Bugs:                 blitz-bugs@cybervision.com | 
|---|
| 20 | * | 
|---|
| 21 | * For more information, please see the Blitz++ Home Page: | 
|---|
| 22 | *    http://seurat.uwaterloo.ca/blitz/ | 
|---|
| 23 | * | 
|---|
| 24 | *************************************************************************** | 
|---|
| 25 | * $Log: not supported by cvs2svn $ | 
|---|
| 26 | * Revision 1.4  1998/03/14 00:04:47  tveldhui | 
|---|
| 27 | * 0.2-alpha-05 | 
|---|
| 28 | * | 
|---|
| 29 | * Revision 1.3  1997/07/16 14:51:20  tveldhui | 
|---|
| 30 | * Update: Alpha release 0.2 (Arrays) | 
|---|
| 31 | * | 
|---|
| 32 | * Revision 1.2  1997/01/24 14:42:00  tveldhui | 
|---|
| 33 | * Periodic RCS update | 
|---|
| 34 | * | 
|---|
| 35 | */ | 
|---|
| 36 |  | 
|---|
| 37 | #ifndef BZ_RANDOM_H | 
|---|
| 38 | #define BZ_RANDOM_H | 
|---|
| 39 |  | 
|---|
| 40 | #ifndef BZ_BLITZ_H | 
|---|
| 41 | #include <blitz/blitz.h> | 
|---|
| 42 | #endif | 
|---|
| 43 |  | 
|---|
| 44 | BZ_NAMESPACE(blitz) | 
|---|
| 45 |  | 
|---|
| 46 | template<class P_distribution> | 
|---|
| 47 | class Random { | 
|---|
| 48 |  | 
|---|
| 49 | public: | 
|---|
| 50 | typedef P_distribution T_distribution; | 
|---|
| 51 | typedef _bz_typename T_distribution::T_numtype T_numtype; | 
|---|
| 52 |  | 
|---|
| 53 | Random(double parm1=0.0, double parm2=1.0, double parm3=0.0) | 
|---|
| 54 | : generator_(parm1, parm2, parm3) | 
|---|
| 55 | { } | 
|---|
| 56 |  | 
|---|
| 57 | void randomize() | 
|---|
| 58 | { generator_.randomize(); } | 
|---|
| 59 |  | 
|---|
| 60 | T_numtype random() | 
|---|
| 61 | { return generator_.random(); } | 
|---|
| 62 |  | 
|---|
| 63 | operator T_numtype() | 
|---|
| 64 | { return generator_.random(); } | 
|---|
| 65 |  | 
|---|
| 66 | protected: | 
|---|
| 67 | T_distribution generator_; | 
|---|
| 68 | }; | 
|---|
| 69 |  | 
|---|
| 70 | BZ_NAMESPACE_END | 
|---|
| 71 |  | 
|---|
| 72 | #include <blitz/randref.h> | 
|---|
| 73 |  | 
|---|
| 74 | #endif // BZ_RANDOM_H | 
|---|
| 75 |  | 
|---|