std::uniform_int_distribution a() method in C++ with examples
Last Updated :
17 Jun, 2019
The a() method of uniform_int_distribution class in C++ is used to get the lower bound of this uniform_int_distribution. If there is no lower bound then this method returns 0.
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_int_distribution. Its default value is 0.
Example:
#include <iostream>
#include <random>
using namespace std;
int main()
{
int a = 10, b = 100;
uniform_int_distribution< int > distribution(a, b);
cout << "Lower Bound: "
<< distribution.a() << endl;
return 0;
}
|
Reference: https://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution/params
Share your thoughts in the comments
Please Login to comment...