---
name: "std::exponential_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::exponential_distribution/3cxx"
---

# std::exponential\_distribution(3cxx)

An exponential continuous distribution for random numbers.

## NAME

std::exponential\_distribution\< \_RealType \> - An exponential continuous distribution for random numbers.

## SYNOPSIS

`#include <random>`

### Classes

struct **param\_type**\

### Public Types

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

### Public Member Functions

**exponential\_distribution** ()\
 Constructs an exponential distribution with inverse scale parameter 1.0.  **exponential\_distribution** (\_RealType **\_\_lambda**)\
 Constructs an exponential distribution with inverse scale parameter $$.  **exponential\_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)\
 \_RealType **lambda** () const\
 Returns the inverse scale parameter of the distribution.  **result\_type** **max** () const\
 Returns the least upper bound value of the distribution.  **result\_type** **min** () const\
 Returns the greatest lower bound value of the distribution.  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 **exponential\_distribution** &**\_\_d1**, const **exponential\_distribution** &**\_\_d2**)\
 Return true if two exponential distributions have the same parameters.

## Detailed Description

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

class std::exponential\_distribution\< \_RealType \>"An exponential continuous distribution for random numbers.

The formula for the exponential probability density function is $p(x\|) =  e^{- x}$.

Mean$ac{1}{}$ Median$ac{ge$\[0, infty\]$ Standard Deviation$ac{1}{}$

## Member Typedef Documentation

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

The type of the range of the distribution.

## Constructor & Destructor Documentation

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

Constructs an exponential distribution with inverse scale parameter 1.0.

### template\<typename \_RealType = double\> std::exponential\_distribution\< \_RealType \>::exponential\_distribution (\_RealType \_\_lambda)` [inline]`, ` [explicit]`

Constructs an exponential distribution with inverse scale parameter $$.

## Member Function Documentation

### template\<typename \_RealType = double\> \_RealType std::exponential\_distribution\< \_RealType \>::lambda () const` [inline]`

Returns the inverse scale parameter of the distribution.

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

Returns the least upper bound value of the distribution.

References **std::numeric\_limits\< \_Tp \>::max()**.

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

Returns the greatest lower bound value of the distribution.

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

Generating functions.

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

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

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

Returns the parameter set of the distribution.

### template\<typename \_RealType = double\> void std::exponential\_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::exponential\_distribution\< \_RealType \>::reset ()` [inline]`

Resets the distribution state. Has no effect on exponential distributions.

## Friends And Related Symbol Documentation

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

Return true if two exponential distributions have the same parameters.

## Author

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