The cauchy_distribution::a() function is an inbuilt function in C++ STL which is used to returns the distribution parameter associated with Cauchy distribution. The class cauchy_distribution is present in header file random. Before going to the syntax of the function, brief introduction to Cauchy Distribution.
Cauchy Distribution A random variable X is said to follow Cauchy Distribution with parameter a and b if it has the probability density function of the form,
![]()
Where a is the location parameter specifying the location of peak of the distribution and b is the scale parameter specifying the half-width at half-maximum. Mean and Variance of the distribution is not defined, but its median and mode both exists and equals to a.
Syntax:
cauchy_distribution_name.a()
Parameters: This function does not accepts any parameter.
Return Value: The function returns the distribution parameter associated with the distribution. This parameter is known as the peak location parameter of the Cauchy distribution, which determines the shift to either side of the distribution shape. The parameter is set on construction.
Below programs illustrates the cauchy_distribution::a() function in C++ STL:
Program 1:
// CPP program to illustrate // cauchy_distribution::a() #include <iostream> #include <random> using namespace std; // Driver program int main() { default_random_engine generator; cauchy_distribution<double> d(0.78, 1.45); // prints the first value cout << "Cauchy distribution: " << d.a(); return 0; } |
Cauchy distribution: 0.78
Program 2:
// CPP program to illustrate // cauchy_distribution::a() #include <iostream> #include <random> using namespace std; // Driver program int main() { default_random_engine generator; // Define a cauchy distribution with default // parameters a=0.0 and b=1.0 cauchy_distribution<double> d; // prints the first value cout << "Cauchy distribution: " << d.a(); return 0; } |
Cauchy distribution: 0
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- isalpha() and isdigit() functions in C with cstring examples.
- Pointers in C/C++ with Examples
- strtok() and strtok_r() functions in C with examples
- memset() in C with examples
- std::mismatch() with examples in C++
- wcscpy() function in C++ with Examples
- wcscmp() function in C++ with Examples
- set_symmetric_difference in C++ with Examples
- ratio_equal() in C++ with examples
- std::equal_to in C++ with Examples
- quick_exit() function in C++ with Examples
- feclearexcept in C++ with Examples
- Understanding Lvalues, PRvalues and Xvalues in C/C++ with Examples
- multiset lower_bound() in C++ STL with Examples
- multiset upper_bound() in C++ STL with Examples
- multiset max_size() in C++ STL with Examples
- forward_list max_size() in C++ STL with Examples
- std::allocator() in C++ with Examples
- array data() in C++ STL with Examples
- multiset size() in C++ STL with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

