exponential_distribution::lambda

Returns the lambda distribution parameter.

result_type lambda() const;

The member function returns the stored value stored_lambda.

 

// std_tr1__random__exponential_distribution_lambda.cpp 
// compile with: /EHsc 
#include <random> 
#include <iostream> 
 
typedef std::ranlux64_base_01 Myeng; 
typedef std::exponential_distribution<double> Mydist; 
int main() 
    { 
    Myeng eng; 
    Mydist dist(1.5); 
    Mydist::input_type engval = eng(); 
    Mydist::result_type distval = dist(eng); 
 
    distval = distval;  // to quiet "unused" warnings 
    engval = engval; 
 
    std::cout << "lambda == " << dist.lambda() << std::endl; 
 
    dist.reset(); // discard any cached values 
    std::cout << "a random value == " << dist(eng) << std::endl; 
    std::cout << "a random value == " << dist(eng) << std::endl; 
    std::cout << "a random value == " << dist(eng) << std::endl; 
 
    return (0); 
    } 
 
lambda == 1.5
a random value == 0.223809
a random value == 0.168898
a random value == 0.176395

Header: <random>

Namespace: std

Community Additions

ADD
Show: