The DSFMT class implements parts of the Double precision SIMD-oriented Fast Mersenne Twister (dSFM) random number generator. DSFMT directly generates double precision floating point random numbers, which have the IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) format. DSFMT does not support integer outputs. More...
#include <random_dsfmt.h>
Classes | |
union | W128_T |
128-bit data structure | |
Public Member Functions | |
DSFMT () | |
Default constructor. | |
DSFMT (unsigned int seed) | |
Constructor using a certain seed. | |
void | randomize () |
Set the seed to a semi-random value (based on hashed time and clock). | |
void | reset () |
Reset the generator with the same seed as used last time. | |
void | reset (unsigned int seed) |
Initialise the generator with a new seed (. | |
double | random_01 () |
Return a uniformly distributed (0,1) value. | |
double | random_01_lclosed () |
Return a uniformly distributed [0,1) value. | |
double | random_01_rclosed () |
Return a uniformly distributed (0,1] value. | |
uint32_t | random_int () |
Return a uniformly distributed [0, UINT_MAX) value. | |
ivec | get_state () const |
Return current state of generator in the form of ivec. | |
void | set_state (const ivec &state) |
Resume the state of the generator from a previously saved ivec. | |
void | init_gen_rand (unsigned int seed) |
Initialise the generator with a new seed. | |
Static Public Member Functions | |
static uint32_t | genrand_uint32 () |
Generate uniform [0, UINT_MAX) integer pseudorandom number. | |
static double | genrand_close1_open2 () |
Generate uniform [1, 2) double pseudorandom number. | |
static double | genrand_close_open () |
Generate uniform [0, 1) double pseudorandom number. | |
static double | genrand_open_close () |
Generate uniform (0, 1] double pseudorandom number. | |
static double | genrand_open_open () |
Generate uniform (0, 1) double pseudorandom number. |
The DSFMT class implements parts of the Double precision SIMD-oriented Fast Mersenne Twister (dSFM) random number generator. DSFMT directly generates double precision floating point random numbers, which have the IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) format. DSFMT does not support integer outputs.
Visit http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html for more details on the original dSFMT implementation.
Here is a copy of the LICENSE.txt file from the dSFMT-src-2.0.tar.gz package, on which C++ DSFMT implementation is based:
* Copyright (c) 2007, 2008 Mutsuo Saito, Makoto Matsumoto and Hiroshima * University. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of the Hiroshima University nor the names of * its contributors may 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. *
static double itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::genrand_close1_open2 | ( | ) | [inline, static] |
Generate uniform [1, 2) double pseudorandom number.
This function generates and returns double precision pseudorandom number which distributes uniformly in the range [1, 2). This is the primitive and faster than generating numbers in other ranges. init_gen_rand()
must be called before this function.
Referenced by itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::genrand_close_open(), and itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::genrand_open_close().
static double itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::genrand_close_open | ( | ) | [inline, static] |
Generate uniform [0, 1) double pseudorandom number.
This function generates and returns double precision pseudorandom number which distributes uniformly in the range [0, 1). init_gen_rand()
must be called before this function.
Referenced by itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::random_01_lclosed(), itpp::Uniform_RNG::sample(), itpp::I_Uniform_RNG::sample(), itpp::Bernoulli_RNG::sample(), itpp::Normal_RNG::sample(), and itpp::Gamma_RNG::sample().
static double itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::genrand_open_close | ( | ) | [inline, static] |
Generate uniform (0, 1] double pseudorandom number.
This function generates and returns double precision pseudorandom number which distributes uniformly in the range (0, 1]. init_gen_rand()
must be called before this function.
Referenced by itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::random_01_rclosed(), and itpp::Gamma_RNG::sample().
static double itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::genrand_open_open | ( | ) | [inline, static] |
Generate uniform (0, 1) double pseudorandom number.
This function generates and returns double precision pseudorandom number which distributes uniformly in the range (0, 1). init_gen_rand()
must be called before this function.
Referenced by itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::random_01(), itpp::Laplace_RNG::sample(), and itpp::Gamma_RNG::sample().
void itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::init_gen_rand | ( | unsigned int | seed | ) | [inline] |
Initialise the generator with a new seed.
This function initializes the internal state array with a 32-bit integer seed.
seed | a 32-bit integer used as the seed. |
Referenced by itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::DSFMT(), itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::randomize(), and itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::reset().
void itpp::DSFMT< MEXP, POS1, SL1, MSK1, MSK2, MSK32_1, MSK32_2, MSK32_3, MSK32_4, FIX1, FIX2, PCV1, PCV2 >::reset | ( | unsigned int | seed | ) | [inline] |