x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
additive_combine.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\random\additive_combine.hpp
Girar
Efecto
Propiedad
Historial
/* boost random/additive_combine.hpp header file * * Copyright Jens Maurer 2000-2001 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * * $Id: additive_combine.hpp 41369 2007-11-25 18:07:19Z bemandawes $ * * Revision history * 2001-02-18 moved to individual header files */ #ifndef BOOST_RANDOM_ADDITIVE_COMBINE_HPP #define BOOST_RANDOM_ADDITIVE_COMBINE_HPP #include
#include
// for std::min and std::max #include
#include
#include
namespace boost { namespace random { // L'Ecuyer 1988 template
class additive_combine { public: typedef MLCG1 first_base; typedef MLCG2 second_base; typedef typename MLCG1::result_type result_type; #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION static const bool has_fixed_range = true; static const result_type min_value = 1; static const result_type max_value = MLCG1::max_value-1; #else enum { has_fixed_range = false }; #endif result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 1; } result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_mlcg1.max)()-1; } additive_combine() : _mlcg1(), _mlcg2() { } additive_combine(typename MLCG1::result_type seed1, typename MLCG2::result_type seed2) : _mlcg1(seed1), _mlcg2(seed2) { } template
additive_combine(It& first, It last) : _mlcg1(first, last), _mlcg2(first, last) { } void seed() { _mlcg1.seed(); _mlcg2.seed(); } void seed(typename MLCG1::result_type seed1, typename MLCG2::result_type seed2) { _mlcg1.seed(seed1); _mlcg2.seed(seed2); } template
void seed(It& first, It last) { _mlcg1.seed(first, last); _mlcg2.seed(first, last); } result_type operator()() { result_type z = _mlcg1() - _mlcg2(); if(z < 1) z += MLCG1::modulus-1; return z; } static bool validation(result_type x) { return val == x; } #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS template
friend std::basic_ostream
& operator<<(std::basic_ostream
& os, const additive_combine& r) { os << r._mlcg1 << " " << r._mlcg2; return os; } template
friend std::basic_istream
& operator>>(std::basic_istream
& is, additive_combine& r) { is >> r._mlcg1 >> std::ws >> r._mlcg2; return is; } #endif friend bool operator==(const additive_combine& x, const additive_combine& y) { return x._mlcg1 == y._mlcg1 && x._mlcg2 == y._mlcg2; } friend bool operator!=(const additive_combine& x, const additive_combine& y) { return !(x == y); } #else // Use a member function; Streamable concept not supported. bool operator==(const additive_combine& rhs) const { return _mlcg1 == rhs._mlcg1 && _mlcg2 == rhs._mlcg2; } bool operator!=(const additive_combine& rhs) const { return !(*this == rhs); } #endif private: MLCG1 _mlcg1; MLCG2 _mlcg2; }; } // namespace random typedef random::additive_combine< random::linear_congruential
, random::linear_congruential
, 2060321752> ecuyer1988; } // namespace boost #endif // BOOST_RANDOM_ADDITIVE_COMBINE_HPP
additive_combine.hpp
Dirección de la página
Dirección del archivo
Anterior 1/28
Siguiente
Descargar
( 3 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.