# 26 Numerics library [numerics]

## 26.6 Random number generation [rand]

### 26.6.9 Random number distribution class templates [rand.dist]

#### 26.6.9.2.1 Class template uniform_­int_­distribution[rand.dist.uni.int]

A uniform_­int_­distribution random number distribution produces random integers i, , distributed according to the constant discrete probability function
template<class IntType = int> class uniform_int_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructors and reset functions uniform_int_distribution() : uniform_int_distribution(0) {} explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max()); explicit uniform_int_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions result_type a() const; result_type b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
```explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max()); ```
Preconditions: .
Remarks: a and b correspond to the respective parameters of the distribution.
```result_type a() const; ```
Returns: The value of the a parameter with which the object was constructed.
```result_type b() const; ```
Returns: The value of the b parameter with which the object was constructed.

#### 26.6.9.2.2 Class template uniform_­real_­distribution[rand.dist.uni.real]

A uniform_­real_­distribution random number distribution produces random numbers x, , distributed according to the constant probability density function
[Note 1:
This implies that is undefined when a == b.
— end note]
template<class RealType = double> class uniform_real_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructors and reset functions uniform_real_distribution() : uniform_real_distribution(0.0) {} explicit uniform_real_distribution(RealType a, RealType b = 1.0); explicit uniform_real_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions result_type a() const; result_type b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
```explicit uniform_real_distribution(RealType a, RealType b = 1.0); ```
Preconditions: and .
Remarks: a and b correspond to the respective parameters of the distribution.
```result_type a() const; ```
Returns: The value of the a parameter with which the object was constructed.
```result_type b() const; ```
Returns: The value of the b parameter with which the object was constructed.