uniform_real::uniform_real
Distribuce konstrukce.
explicit uniform_real(result_type min0 = result_type(0), result_type max0 = result_type(1));
Parametry
min0
Dolní mez pro náhodné hodnoty.max0
Horní mez pro náhodné hodnoty.
Poznámky
Předběžná podmínka:min0 < max0
Konstruktor konstrukce objektu, jehož uložená hodnota stored_min obsahuje hodnotu min0 a jehož uložená hodnota stored_max obsahuje hodnotu max0.
Příklad
// std_tr1__random__uniform_real_construct.cpp
// compile with: /EHsc
#include <random>
#include <iostream>
typedef std::ranlux64_base_01 Myeng;
typedef std::uniform_real<double> Myceng;
int main()
{
Myeng eng;
Myceng ceng(1.0, 2.0);
Myceng::input_type engval = eng();
Myceng::result_type compval = ceng(eng);
compval = compval; // to quiet "unused" warnings
engval = engval;
std::cout << "min == " << ceng.min() << std::endl;
std::cout << "max == " << ceng.max() << std::endl;
ceng.reset(); // discard any cached values
std::cout << "a random value == " << ceng(eng) << std::endl;
std::cout << "a random value == " << ceng(eng) << std::endl;
std::cout << "a random value == " << ceng(eng) << std::endl;
return (0);
}
Požadavky
Záhlaví: <random>
Obor názvů: std