source: XMLIO_V2/external/include/blitz/random.h @ 73

Last change on this file since 73 was 73, checked in by ymipsl, 14 years ago
  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/***************************************************************************
2 * blitz/random.h       Random number generator wrapper class
3 *
4 * $Id: random.h,v 1.4 2003/12/11 03:44:22 julianc Exp $
5 *
6 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
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-dev@oonumerics.org
19 * Bugs:                 blitz-bugs@oonumerics.org
20 *
21 * For more information, please see the Blitz++ Home Page:
22 *    http://oonumerics.org/blitz/
23 *
24 ***************************************************************************/
25
26#ifndef BZ_RANDOM_H
27#define BZ_RANDOM_H
28
29#ifndef BZ_BLITZ_H
30 #include <blitz/blitz.h>
31#endif
32
33BZ_NAMESPACE(blitz)
34
35template<typename P_distribution>
36class Random {
37
38public:
39    typedef P_distribution T_distribution;
40    typedef _bz_typename T_distribution::T_numtype T_numtype;
41
42    Random(double parm1=0.0, double parm2=1.0, double parm3=0.0)
43        : generator_(parm1, parm2, parm3)
44    { }
45
46    void randomize()
47    { generator_.randomize(); }
48   
49    T_numtype random()
50    { return generator_.random(); }
51
52    operator T_numtype()
53    { return generator_.random(); }
54
55protected: 
56    T_distribution generator_;
57};
58
59BZ_NAMESPACE_END
60
61#include <blitz/randref.h>
62
63#endif // BZ_RANDOM_H
64
Note: See TracBrowser for help on using the repository browser.