IT++ Logo
Namespaces | Functions | Variables
random.cpp File Reference

Implementation of classes for random number generators. More...

#include <itpp/base/random.h>
#include <itpp/base/itcompat.h>
#include <itpp/base/math/elem_math.h>

Go to the source code of this file.

Namespaces

 itpp
 itpp namespace
 

Functions

ActiveDSFMT::Context & itpp::random_details::lc_get ()
 Function to access thread-local context for random numbers generation.
 
bool itpp::random_details::lc_is_initialized ()
 Function to check if thread-local context is initialized.
 
void itpp::random_details::lc_mark_initialized ()
 Function to mark thread-local context as initialized.
 
static unsigned int itpp::random_details::hash_time_to_seed (time_t t, clock_t c)
 Get an unsigned int from time variables t and c. More...
 
GlobalSeedProvider & itpp::global_seed_provider ()
 
void itpp::GlobalRNG_reset (unsigned int seed)
 Set the internal seed of the Global Seed Provider.
 
void itpp::GlobalRNG_reset ()
 Reset the internal seed of the Global Seed Provider to the previously set value.
 
unsigned int itpp::GlobalRNG_get_local_seed ()
 Get new seed to initialize thread-local generators.
 
void itpp::GlobalRNG_randomize ()
 Set a random seed for the Global Seed Provider seed.
 
void itpp::GlobalRNG_get_state (ivec &state)
 Save current full state of global seed provider in memory.
 
void itpp::GlobalRNG_set_state (const ivec &state)
 Resume the global seed provider state saved in memory.
 
void itpp::RNG_reset (unsigned int seed)
 Set the seed for all Random Number Generators in the current thread.
 
void itpp::RNG_reset ()
 Reset the seed to the previously set value for all Random Number Generators in the current thread. More...
 
void itpp::RNG_randomize ()
 Set a random seed for all Random Number Generators in the current thread.
 
void itpp::RNG_get_state (ivec &state)
 Save Random Number generation context used in the current thread.
 
void itpp::RNG_set_state (const ivec &state)
 Resume Random Number generation in the current thread with previously stored context.
 

Variables

static ActiveDSFMT::Context itpp::random_details::thread_local_context
 
static bool itpp::random_details::is_thread_local_context_initialized = false
 

Detailed Description

Implementation of classes for random number generators.

Author
Tony Ottosson and Adam Piatyszek

Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors)

This file is part of IT++ - a C++ library of mathematical, signal processing, speech processing, and communications classes and functions.

IT++ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

IT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with IT++. If not, see http://www.gnu.org/licenses/.


Definition in file random.cpp.

Function Documentation

◆ hash_time_to_seed()

static unsigned int itpp::random_details::hash_time_to_seed ( time_t  t,
clock_t  c 
)
static

Get an unsigned int from time variables t and c.

Better than uint(x) in case x is floating point in [0,1] Based on code by Lawrence Kirby (fred@.nosp@m.gene.nosp@m.sis.d.nosp@m.emon.nosp@m..co.u.nosp@m.k)

Definition at line 68 of file random.cpp.

References itpp::random_details::hash_time_to_seed(), and itpp::max().

Referenced by itpp::random_details::hash_time_to_seed().

SourceForge Logo

Generated on Sun Apr 10 2022 12:00:00 for IT++ by Doxygen 1.8.14