libfxd 0.2.dev
A fixed-point library for C++.
Loading...
Searching...
No Matches
uniform_real_distribution< Fxd > Class Template Reference

Analogous to std::uniform_real_distribution. More...

#include <random.hpp>

Classes

class  param_type
 Analogous to std::uniform_real_distribution::param_type More...
 

Public Types

using result_type = Fxd
 The type that will be generated.
 

Public Member Functions

 uniform_real_distribution ()
 Default constructor.
 
 uniform_real_distribution (result_type a_, result_type b_=std::numeric_limits< result_type >::max())
 Constructor with min and max values.
 
 uniform_real_distribution (const param_type &p)
 Constructor from a param_type object.
 
void reset () noexcept
 Reset distribution state.
 
result_type a () const noexcept
 Same as min().
 
result_type b () const noexcept
 Same as max().
 
param_type param () const noexcept
 Obtain distribution parameters.
 
void param (const param_type &p)
 Set distribution parameters.
 
result_type min () const noexcept
 Return lower bound of distribution.
 
result_type max () const noexcept
 Return upper bound of distribution.
 
template<typename Gen >
result_type operator() (Gen &g)
 Generate a random value.
 
template<typename Gen >
result_type operator() (Gen &g, const param_type &p)
 Generate a random value from a specific parameters object.
 
bool operator== (const uniform_real_distribution &) const =default
 Defaulted == operator.
 

Friends

template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &out, const uniform_real_distribution &dist)
 Output operator.
 
template<typename CharT , typename Traits >
std::basic_istream< CharT, Traits > & operator>> (std::basic_istream< CharT, Traits > &in, const uniform_real_distribution &dist)
 Input operator.
 

Detailed Description

template<fixed_point Fxd>
class fxd::uniform_real_distribution< Fxd >

Analogous to std::uniform_real_distribution.

Examples
closest-pair.cpp, and matrix-mul.cpp.

Definition at line 23 of file random.hpp.

Member Typedef Documentation

◆ result_type

using result_type = Fxd

The type that will be generated.

Definition at line 31 of file random.hpp.

Constructor & Destructor Documentation

◆ uniform_real_distribution() [1/3]

Default constructor.

Definition at line 73 of file random.hpp.

◆ uniform_real_distribution() [2/3]

uniform_real_distribution ( result_type  a_,
result_type  b_ = std::numeric_limits<result_type>::max() 
)
inlineexplicit

Constructor with min and max values.

Parameters
a_Minimum value.
b_Maximum value (inclusive).

Definition at line 84 of file random.hpp.

◆ uniform_real_distribution() [3/3]

uniform_real_distribution ( const param_type p)
inlineexplicit

Constructor from a param_type object.

Definition at line 92 of file random.hpp.

Member Function Documentation

◆ a()

result_type a ( ) const
inlinenoexcept

Same as min().

Definition at line 103 of file random.hpp.

◆ b()

result_type b ( ) const
inlinenoexcept

Same as max().

Definition at line 112 of file random.hpp.

◆ max()

result_type max ( ) const
inlinenoexcept

Return upper bound of distribution.

Definition at line 151 of file random.hpp.

◆ min()

result_type min ( ) const
inlinenoexcept

Return lower bound of distribution.

Definition at line 141 of file random.hpp.

◆ operator()() [1/2]

result_type operator() ( Gen &  g)
inline

Generate a random value.

Definition at line 162 of file random.hpp.

◆ operator()() [2/2]

result_type operator() ( Gen &  g,
const param_type p 
)
inline

Generate a random value from a specific parameters object.

Definition at line 172 of file random.hpp.

◆ operator==()

bool operator== ( const uniform_real_distribution< Fxd > &  ) const
default

Defaulted == operator.

◆ param() [1/2]

param_type param ( ) const
inlinenoexcept

Obtain distribution parameters.

Definition at line 122 of file random.hpp.

◆ param() [2/2]

void param ( const param_type p)
inline

Set distribution parameters.

Definition at line 131 of file random.hpp.

◆ reset()

void reset ( )
inlinenoexcept

Reset distribution state.

Definition at line 98 of file random.hpp.

Friends And Related Function Documentation

◆ operator<<

std::basic_ostream< CharT, Traits > & operator<< ( std::basic_ostream< CharT, Traits > &  out,
const uniform_real_distribution< Fxd > &  dist 
)
friend

Output operator.

Definition at line 186 of file random.hpp.

◆ operator>>

std::basic_istream< CharT, Traits > & operator>> ( std::basic_istream< CharT, Traits > &  in,
const uniform_real_distribution< Fxd > &  dist 
)
friend

Input operator.

Definition at line 221 of file random.hpp.


The documentation for this class was generated from the following file: