public member function
<random>

std::piecewise_constant_distribution::param

(1)
param_type param() const;
(2)
void param (const param_type& parm);
Distribution parameters
The first version (1) returns an object with the parameters currently associated with the distribution object.
The second version (2) associates the parameters in object parm to the distribution object.

A piecewise_constant_distribution is defined by a sequence of subintervals with different probability densities. An object of type param_type carries this information, but it is meant to be used only to construct or specify the parameters for a piecewise_constant_distribution object, not to inspect their individual values.

To inspect the individual values associated to the distribution object you can use: piecewise_constant_distribution::intervals and piecewise_constant_distribution::densities.

Parameters

parm
An object representing the distribution's parameters, obtained by a call to member function param.
param_type is a member type.

Return value

An object representing the distribution's parameters.
param_type is a member type.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// piecewise_constant_distribution::param
#include <iostream>
#include <random>

int main()
{
  std::default_random_engine generator;
  std::piecewise_constant_distribution<double> d1 ( 5, 0.0, 10.0, [](double x){return x;} );
  std::piecewise_constant_distribution<double> d2 (d1.param());

  // print two independent values:
  std::cout << d1(generator) << std::endl;
  std::cout << d2(generator) << std::endl;

  return 0;
}

Possible output:
3.52563
6.70464


Complexity

No worse than the complexity of param_type's constructor.

See also