Open In App

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

Last Updated : 17 Jun, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The b() method of uniform_real_distribution class in C++ is used to get the upper bound of this uniform_real_distribution. Syntax:
result_type b() const;
Parameters: This method do not accepts any parameters. Return Value: This method return the 'b' parameter in the distribution, which is the upper bound or the maximum possibly generated value in this uniform_real_distribution. Example: CPP
// C++ code to demonstrate
// the working of b() 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 b()
    cout << "Upper Bound: "
         << distribution.b() << endl;

    return 0;
}
Output:
Upper Bound: 20.5
Reference: http://www.cplusplus.com/reference/random/uniform_real_distribution/b/

Next Article
Article Tags :
Practice Tags :

Similar Reads