Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

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.


Want to learn from the best curated videos and practice problems, check out the C++ Foundation Course for Basic to Advanced C++ and C++ STL Course for foundation plus STL.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.
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.


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


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!