Open In App

std::uniform_real_distribution a() method in C++ with Examples

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

The a() method of uniform_real_distribution class in C++ is used to get the lower bound of this uniform_real_distribution.

Syntax:

result_type a() const;

Parameters: This method do not accepts any parameters.

Return Value: This method return the ‘a’ parameter in the distribution, which is the lower bound or the minimum possibly generated value in this uniform_real_distribution.

Example:




// C++ code to demonstrate
// the working of a() function
  
#include <iostream>
  
// for uniform_real_distribution function
#include <random>
  
using namespace std;
  
int main()
{
    double a = 10, b = 20.5;
  
    // Initializing of uniform_real_distribution class
    uniform_real_distribution<double> distribution(a, b);
  
    // Using a()
    cout << "Lower Bound: "
         << distribution.a() << endl;
  
    return 0;
}


Output:

Lower Bound: 10

Reference: http://www.cplusplus.com/reference/random/uniform_real_distribution/a/


Last Updated : 17 Jun, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads