Skip to content
Related Articles

Related Articles

Improve Article
std::uniform_real_distribution min() method in C++ with Examples
  • Last Updated : 17 Jun, 2019

The min() method of uniform_real_distribution class in C++ is used to get the minimum possible value that can be generated by this uniform_real_distribution.

Syntax:

result_type min() const;

Parameters: This method do not accepts any parameters.

Return Value: This method return the minimum possibly generated value in this uniform_real_distribution.

Example:




// C++ code to demonstrate
// the working of min() 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 min()
    cout << "Min value that can be generated"
         << " by this uniform_real_distribution: "
         << distribution.min() << endl;
  
    return 0;
}
Output:
Min value that can be generated by this uniform_real_distribution: 10

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

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.
My Personal Notes arrow_drop_up
Recommended Articles
Page :