shark::Geometric< RngType > Class Template Reference

Implements the geometric distribution. More...

#include <shark/Rng/Geometric.h>

+ Inheritance diagram for shark::Geometric< RngType >:

Public Member Functions

 Geometric (RngType &rng, double p=0.5)
 C'tor, initializes the parameter p modelling the probability of success. Associates the distribution with a custom RNG. More...
 
long operator() (double p)
 Reinitializes the distribution with the supplied success probability and samples a random number. More...
 
double prob () const
 Accesses the success probability. More...
 
void prob (double newMean)
 Adjusts the success probability. More...
 
double p (long x)
 Calculates the probability of x. More...
 

Detailed Description

template<typename RngType = shark::DefaultRngType>
class shark::Geometric< RngType >

Implements the geometric distribution.

Note that a support {1,2,3,...} is assumed here.

Definition at line 47 of file Geometric.h.

Constructor & Destructor Documentation

◆ Geometric()

template<typename RngType = shark::DefaultRngType>
shark::Geometric< RngType >::Geometric ( RngType &  rng,
double  p = 0.5 
)
inline

C'tor, initializes the parameter p modelling the probability of success. Associates the distribution with a custom RNG.

Parameters
[in,out]rngThe RNG to associate the distribution with.
[in]pParameter p, the probability of success.

Definition at line 58 of file Geometric.h.

Member Function Documentation

◆ operator()()

template<typename RngType = shark::DefaultRngType>
long shark::Geometric< RngType >::operator() ( double  p)
inline

Reinitializes the distribution with the supplied success probability and samples a random number.

Parameters
[in]pThe new success probability.

Definition at line 69 of file Geometric.h.

◆ p()

template<typename RngType = shark::DefaultRngType>
double shark::Geometric< RngType >::p ( long  x)
inline

Calculates the probability of x.

Definition at line 91 of file Geometric.h.

References shark::Geometric< RngType >::prob().

◆ prob() [1/2]

template<typename RngType = shark::DefaultRngType>
double shark::Geometric< RngType >::prob ( ) const
inline

Accesses the success probability.

Definition at line 77 of file Geometric.h.

Referenced by shark::Geometric< RngType >::p().

◆ prob() [2/2]

template<typename RngType = shark::DefaultRngType>
void shark::Geometric< RngType >::prob ( double  newMean)
inline

Adjusts the success probability.

Definition at line 84 of file Geometric.h.


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