IT++ Logo

itpp::Random_Generator Class Reference
[Random Number Generation]

#include <itpp/base/random.h>

List of all members.


Detailed Description

Base class for random (stochastic) sources.

The Random_Generator class is based on the MersenneTwister MTRand class code in version 1.0 (15 May 2003) by Richard J. Wagner. See http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html for details.

Here are the original release notes copied from the MersenneTwister.h file:

   * Mersenne Twister random number generator -- a C++ class MTRand Based on
   * code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus Richard J.
   * Wagner v1.0 15 May 2003 rjwagner@writeme.com
   *
   * The Mersenne Twister is an algorithm for generating random numbers. It
   * was designed with consideration of the flaws in various other generators.
   * The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
   * are far greater. The generator is also fast; it avoids multiplication and
   * division, and it benefits from caches and pipelines. For more information
   * see the inventors' web page at
   * http://www.math.keio.ac.jp/~matumoto/emt.html

   * Reference:
   * M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
   * Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions
   * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp.
   * 3-30.
   *
   * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
   * Copyright (C) 2000 - 2003, Richard J. Wagner
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *   1. Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *   2. Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in the
   *      documentation and/or other materials provided with the distribution.
   *
   *   3. The names of its contributors may not be used to endorse or promote
   *      products derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
   * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
   * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
   * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * The original code included the following notice:
   *
   *     When you use this, send an email to: matumoto@math.keio.ac.jp with an
   *     appropriate reference to your work.
   *
   * It would be nice to CC: rjwagner@writeme.com and
   * Cokus@math.washington.edu when you write.
   * 

Definition at line 112 of file random.h.


Public Member Functions

 Random_Generator ()
 Construct a new Random_Generator.
 Random_Generator (unsigned int seed)
 Construct Random_Generator object using seed.
void randomize ()
 Set the seed to a semi-random value (based on hashed time and clock).
void reset ()
 Reset the source. The same sequance will be generated as the last time.
void reset (unsigned int seed)
 Reset the source after setting the seed to seed.
unsigned int random_int ()
 Return a uniformly distributed [0,2^32-1] integer.
double random_01 ()
 Return a uniformly distributed (0,1) value.
double random_01_lclosed ()
 Return a uniformly distributed [0,1) value.
double random_01_closed ()
 Return a uniformly distributed [0,1] value.
double random53_01_lclosed ()
 Return a uniformly distributed [0,1) value in 53-bit resolution.
void get_state (ivec &out_state)
 Save current full state of generator in memory.
void set_state (ivec &new_state)
 Resume the state saved in memory. Clears memory.

The documentation for this class was generated from the following files:
SourceForge Logo

Generated on Sun Sep 14 18:52:30 2008 for IT++ by Doxygen 1.5.6