Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Infinity::Engine::ExtremeValueDistribution< RealType > Class Template Reference

Platform-independent extreme value (Gumbel) distribution. More...

#include <PRNGDistribution.hpp>

Classes

struct  param_type
 Parameter set for the distribution. More...
 

Public Types

using result_type = RealType
 The type of values produced by the distribution.
 

Public Member Functions

 ExtremeValueDistribution ()
 Default constructor. Creates standard Gumbel distribution (a=0, b=1).
 
 ExtremeValueDistribution (RealType a, RealType b=RealType(1))
 Constructs an extreme value distribution with specified parameters.
 
 ExtremeValueDistribution (const param_type &param)
 Constructs from a parameter set.
 
void reset ()
 Resets the distribution state.
 
RealType a () const
 Gets the location parameter.
 
RealType b () const
 Gets the scale parameter.
 
param_type param () const
 Gets the current parameter set.
 
void param (const param_type &param)
 Sets new parameters for the distribution.
 
result_type min () const
 Gets the theoretical minimum value (negative infinity).
 
result_type max () const
 Gets the theoretical maximum value (positive infinity).
 
template<typename Generator >
result_type operator() (Generator &g)
 Generates the next random value using stored parameters.
 
template<typename Generator >
result_type operator() (Generator &g, const param_type &param)
 Generates the next random value using provided parameters.
 

Friends

bool operator== (const ExtremeValueDistribution &lhs, const ExtremeValueDistribution &rhs)
 
bool operator!= (const ExtremeValueDistribution &lhs, const ExtremeValueDistribution &rhs)
 

Detailed Description

template<typename RealType = double>
class Infinity::Engine::ExtremeValueDistribution< RealType >

Platform-independent extreme value (Gumbel) distribution.

Produces values according to the Type-I extreme value distribution (Gumbel distribution). Used to model the distribution of maximum (or minimum) values in a large sample, making it essential for modeling extreme events and rare occurrences.

The Gumbel distribution appears naturally as the limiting distribution of the maximum (or minimum) of a large number of independent, identically distributed random variables. Common applications include modeling floods, earthquake magnitudes, wind speeds, and other extreme weather events. It also appears in machine learning as the Gumbel-max trick for sampling from categorical distributions.

Template Parameters
RealTypeFloating point type (float or double)

Example usage:

PRNG rng(12345);
// Location=0, Scale=1 (standard Gumbel)
float value = extreme(rng);
// Model annual maximum flood levels
ExtremeValueDistribution<float> flood_max(10.0f, 2.0f);
float max_level = flood_max(rng);
// Extreme wind speed modeling
for (int i = 0; i < 100; ++i) {
double max_speed = wind_max(rng);
}
Platform-independent extreme value (Gumbel) distribution.
Definition PRNGDistribution.hpp:2300
Pseudo-random number generator for procedural generation.
Definition PRNG.hpp:48
Note
Distribution is asymmetric with a longer right tail.
Mean = a + γb where γ ≈ 0.5772 (Euler-Mascheroni constant).
Mode = a (the most likely value is the location parameter).
Variance = (π²/6) * b².

Member Typedef Documentation

◆ result_type

template<typename RealType = double>
using Infinity::Engine::ExtremeValueDistribution< RealType >::result_type = RealType

The type of values produced by the distribution.

Constructor & Destructor Documentation

◆ ExtremeValueDistribution() [1/3]

template<typename RealType = double>
Infinity::Engine::ExtremeValueDistribution< RealType >::ExtremeValueDistribution ( )
inline

Default constructor. Creates standard Gumbel distribution (a=0, b=1).

◆ ExtremeValueDistribution() [2/3]

template<typename RealType = double>
Infinity::Engine::ExtremeValueDistribution< RealType >::ExtremeValueDistribution ( RealType  a,
RealType  b = RealType(1) 
)
inlineexplicit

Constructs an extreme value distribution with specified parameters.

Parameters
aLocation parameter
bScale parameter

◆ ExtremeValueDistribution() [3/3]

template<typename RealType = double>
Infinity::Engine::ExtremeValueDistribution< RealType >::ExtremeValueDistribution ( const param_type param)
inlineexplicit

Constructs from a parameter set.

Parameters
paramThe distribution parameters

Member Function Documentation

◆ a()

template<typename RealType = double>
RealType Infinity::Engine::ExtremeValueDistribution< RealType >::a ( ) const
inline

Gets the location parameter.

◆ b()

template<typename RealType = double>
RealType Infinity::Engine::ExtremeValueDistribution< RealType >::b ( ) const
inline

Gets the scale parameter.

◆ max()

template<typename RealType = double>
result_type Infinity::Engine::ExtremeValueDistribution< RealType >::max ( ) const
inline

Gets the theoretical maximum value (positive infinity).

◆ min()

template<typename RealType = double>
result_type Infinity::Engine::ExtremeValueDistribution< RealType >::min ( ) const
inline

Gets the theoretical minimum value (negative infinity).

◆ operator()() [1/2]

template<typename RealType = double>
template<typename Generator >
result_type Infinity::Engine::ExtremeValueDistribution< RealType >::operator() ( Generator &  g)
inline

Generates the next random value using stored parameters.

Template Parameters
GeneratorThe random number generator type (e.g., PRNG)
Parameters
gThe random number generator
Returns
A random value from the extreme value distribution

◆ operator()() [2/2]

template<typename RealType = double>
template<typename Generator >
result_type Infinity::Engine::ExtremeValueDistribution< RealType >::operator() ( Generator &  g,
const param_type param 
)
inline

Generates the next random value using provided parameters.

Uses the inverse CDF method: X = a - b * ln(-ln(U)) where U ~ Uniform(0, 1) and X ~ Gumbel(a, b).

The double logarithm transformation creates the characteristic long right tail that makes this distribution suitable for modeling extreme maxima.

Template Parameters
GeneratorThe random number generator type (e.g., PRNG)
Parameters
gThe random number generator
paramThe distribution parameters to use for this generation
Returns
A random value from Gumbel(param.a(), param.b())

◆ param() [1/2]

template<typename RealType = double>
param_type Infinity::Engine::ExtremeValueDistribution< RealType >::param ( ) const
inline

Gets the current parameter set.

◆ param() [2/2]

template<typename RealType = double>
void Infinity::Engine::ExtremeValueDistribution< RealType >::param ( const param_type param)
inline

Sets new parameters for the distribution.

◆ reset()

template<typename RealType = double>
void Infinity::Engine::ExtremeValueDistribution< RealType >::reset ( )
inline

Resets the distribution state.

No-op for extreme value distribution as it maintains no internal state.

Friends And Related Symbol Documentation

◆ operator!=

template<typename RealType = double>
bool operator!= ( const ExtremeValueDistribution< RealType > &  lhs,
const ExtremeValueDistribution< RealType > &  rhs 
)
friend

◆ operator==

template<typename RealType = double>
bool operator== ( const ExtremeValueDistribution< RealType > &  lhs,
const ExtremeValueDistribution< RealType > &  rhs 
)
friend