---
name: "std::uniform_real_distribution"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::uniform_real_distribution/3cxx"
---

# std::uniform\_real\_distribution(3cxx)

Uniform continuous distribution for random numbers.

## NAME

std::uniform\_real\_distribution\< \_RealType \> - Uniform continuous distribution for random numbers.

## SYNOPSIS

`#include <random>`

### Classes

struct **param\_type**\

### Public Types

**typedef** \_RealType **result\_type**\

### Public Member Functions

**uniform\_real\_distribution** ()\
 Constructs a uniform\_real\_distribution object.  **uniform\_real\_distribution** (\_RealType \_\_a, \_RealType \_\_b=\_RealType(1))\
 Constructs a uniform\_real\_distribution object.  **uniform\_real\_distribution** (const **param\_type** &\_\_p)\
 template\<**typename** **\_ForwardIterator** , **typename** **\_UniformRandomNumberGenerator** \> **void** **\_\_generate** (**\_ForwardIterator** \_\_f, **\_ForwardIterator** \_\_t, **\_UniformRandomNumberGenerator** &**\_\_urng**)\
 template\<**typename** **\_ForwardIterator** , **typename** **\_UniformRandomNumberGenerator** \> **void** **\_\_generate** (**\_ForwardIterator** \_\_f, **\_ForwardIterator** \_\_t, **\_UniformRandomNumberGenerator** &**\_\_urng**, const **param\_type** &\_\_p)\
 template\<**typename** **\_UniformRandomNumberGenerator** \> **void** **\_\_generate** (**result\_type** \*\_\_f, **result\_type** \*\_\_t, **\_UniformRandomNumberGenerator** &**\_\_urng**, const **param\_type** &\_\_p)\
 **result\_type** **a** () const\
 **result\_type** **b** () const\
 **result\_type** **max** () const\
 Returns the inclusive upper bound of the distribution range.  **result\_type** **min** () const\
 Returns the inclusive lower bound of the distribution range.  template\<**typename** **\_UniformRandomNumberGenerator** \> **result\_type** **operator()** (**\_UniformRandomNumberGenerator** &**\_\_urng**)\
 Generating functions.  template\<**typename** **\_UniformRandomNumberGenerator** \> **result\_type** **operator()** (**\_UniformRandomNumberGenerator** &**\_\_urng**, const **param\_type** &\_\_p)\
 **param\_type** **param** () const\
 Returns the parameter set of the distribution.  **void** **param** (const **param\_type** &**\_\_param**)\
 Sets the parameter set of the distribution.  **void** **reset** ()\
 Resets the distribution state.

### Friends

bool **operator==** (const **uniform\_real\_distribution** &**\_\_d1**, const **uniform\_real\_distribution** &**\_\_d2**)\
 Return true if two uniform real distributions have the same parameters.

## Detailed Description

### template\<typename \_RealType = double\>

class std::uniform\_real\_distribution\< \_RealType \>"Uniform continuous distribution for random numbers.

A continuous random distribution on the range \[min, max) with equal probability throughout the range. The URNG should be real-valued and deliver number in the range \[0, 1).

## Member Typedef Documentation

### template\<typename \_RealType = double\> typedef \_RealType std::uniform\_real\_distribution\< \_RealType \>::result\_type

The type of the range of the distribution.

## Constructor & Destructor Documentation

### template\<typename \_RealType = double\> std::uniform\_real\_distribution\< \_RealType \>::uniform\_real\_distribution ()` [inline]`

Constructs a uniform\_real\_distribution object. The lower bound is set to 0.0 and the upper bound to 1.0

### template\<typename \_RealType = double\> std::uniform\_real\_distribution\< \_RealType \>::uniform\_real\_distribution (\_RealType \_\_a, \_RealType \_\_b = `_RealType(1)`)` [inline]`, ` [explicit]`

Constructs a uniform\_real\_distribution object.

**Parameters**

*\_\_a* \[IN\] The lower bound of the distribution. \
 *\_\_b* \[IN\] The upper bound of the distribution.

## Member Function Documentation

### template\<typename \_RealType = double\> result\_type std::uniform\_real\_distribution\< \_RealType \>::max () const` [inline]`

Returns the inclusive upper bound of the distribution range.

### template\<typename \_RealType = double\> result\_type std::uniform\_real\_distribution\< \_RealType \>::min () const` [inline]`

Returns the inclusive lower bound of the distribution range.

### template\<typename \_RealType = double\> template\<typename \_UniformRandomNumberGenerator \> result\_type std::uniform\_real\_distribution\< \_RealType \>::operator() (\_UniformRandomNumberGenerator & \_\_urng)` [inline]`

Generating functions.

References **std::uniform\_real\_distribution\< \_RealType \>::operator()()**.

Referenced by **std::uniform\_real\_distribution\< \_RealType \>::operator()()**.

### template\<typename \_RealType = double\> param\_type std::uniform\_real\_distribution\< \_RealType \>::param () const` [inline]`

Returns the parameter set of the distribution.

### template\<typename \_RealType = double\> void std::uniform\_real\_distribution\< \_RealType \>::param (const param\_type & \_\_param)` [inline]`

Sets the parameter set of the distribution.

**Parameters**

*\_\_param* The new parameter set of the distribution.

### template\<typename \_RealType = double\> void std::uniform\_real\_distribution\< \_RealType \>::reset ()` [inline]`

Resets the distribution state. Does nothing for the uniform real distribution.

## Friends And Related Symbol Documentation

### template\<typename \_RealType = double\> bool operator== (const uniform\_real\_distribution\< \_RealType \> & \_\_d1, const uniform\_real\_distribution\< \_RealType \> & \_\_d2)` [friend]`

Return true if two uniform real distributions have the same parameters.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
