cel_random.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00004 //
00005 // (C) 2003-2006 Celartem Technology Inc. All rights reserved.
00006 //----------------------------------------------------------------------------
00007 /* A C-program for MT19937: Real number version (1999/10/28)    */
00008 /*   genrand() generates one pseudorandom real number (double)  */
00009 /* which is uniformly distributed on [0,1]-interval, for each   */
00010 /* call. sgenrand(seed) sets initial values to the working area */
00011 /* of 624 words. Before genrand(), sgenrand(seed) must be       */
00012 /* called once. (seed is any 32-bit integer.)                   */
00013 /* Integer generator is obtained by modifying two lines.        */
00014 /*   Coded by Takuji Nishimura, considering the suggestions by  */
00015 /* Topher Cooper and Marc Rieffel in July-Aug. 1997.            */
00016 
00017 /* This library is free software under the Artistic license:       */
00018 /* see the file COPYING distributed together with this code.       */
00019 /* For the verification of the code, its output sequence file      */
00020 /* mt19937-1.out is attached (2001/4/2)                           */
00021 
00022 /* Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. */
00023 /* Any feedback is very welcome. For any question, comments,       */
00024 /* see http://www.math.keio.ac.jp/matumoto/emt.html or email       */
00025 /* matumoto@math.keio.ac.jp                                        */
00026 
00027 /* REFERENCE                                                       */
00028 /* M. Matsumoto and T. Nishimura,                                  */
00029 /* "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform  */
00030 /* Pseudo-Random Number Generator",                                */
00031 /* ACM Transactions on Modeling and Computer Simulation,           */
00032 /* Vol. 8, No. 1, January 1998, pp 3--30.                          */
00033 
00034 #ifndef _cel_random_h_
00035 #define _cel_random_h_
00036 
00037 #include "cel_types.h"
00038 
00039 namespace Celartem
00040 {
00045     class Random
00046     {
00047     public:
00052         Random();
00053         
00061         Random(u32 inSeed);
00062         
00070         Random(const Random& inRandom);
00071 
00078         void sgenrand(u32 seed);
00079         
00086         double genrand();
00087 
00096         size_t genrand_n(size_t n);
00097         
00103         u32 forward();
00104 
00105     private:
00106         static const ssize_t N = 624;
00107         u32 m_mt[N];
00108         size_t m_mti;
00109     };
00110 }
00111 
00112 #endif // _cel_random_h_

This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:21:54 2008.