MCKL
Monte Carlo Kernel Library
Classes | Namespaces | Macros | Typedefs | Functions
u01_distribution.hpp File Reference
#include <mckl/random/internal/common.hpp>
#include <mckl/random/u01.hpp>
#include <mckl/random/uniform_bits_distribution.hpp>

Go to the source code of this file.

Classes

class  mckl::U01CanonicalDistribution< RealType >
 Standard uniform distribution on [0, 1) More...
 
class  mckl::U01CanonicalDistribution< RealType >::param_type
 
class  mckl::U01CCDistribution< RealType >
 Standard uniform distribution on [0, 1]. More...
 
class  mckl::U01CCDistribution< RealType >::param_type
 
class  mckl::U01CODistribution< RealType >
 Standard uniform distribution on [0, 1) More...
 
class  mckl::U01CODistribution< RealType >::param_type
 
class  mckl::U01OCDistribution< RealType >
 Standard uniform distribution on (0, 1]. More...
 
class  mckl::U01OCDistribution< RealType >::param_type
 
class  mckl::U01OODistribution< RealType >
 Standard uniform distribution on (0, 1) More...
 
class  mckl::U01OODistribution< RealType >::param_type
 

Namespaces

 mckl
 
 mckl::internal
 

Macros

#define MCKL_DEFINE_RANDOM_U01_DISTRIBUTION(Name, name)
 
#define MCKL_DEFINE_RANDOM_U01_DISTRIBUTION_IMPL(name)
 
#define MCKL_U01_USE_64BITS_DOUBLE   0
 Use 64-bit intermediate random integers for double precison output. More...
 
#define MCKL_U01_USE_FIXED_POINT   0
 Default U01 distribution using fixed point conversion. More...
 

Typedefs

template<typename RealType >
using mckl::U01Distribution = U01CanonicalDistribution< RealType >
 
template<typename RNGType , typename RealType >
using mckl::internal::U01UIntType = std::conditional_t<(RNGTraits< RNGType >::bits >=64||std::is_same< RealType, long double >::value), std::uint64_t, std::uint32_t >
 

Functions

template<typename RealType , typename RNGType >
void mckl::rand (RNGType &rng, U01CanonicalDistribution< RealType > &distribution, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::rand (RNGType &rng, U01CCDistribution< RealType > &distribution, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::rand (RNGType &rng, U01CODistribution< RealType > &distribution, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::rand (RNGType &rng, U01OCDistribution< RealType > &distribution, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::rand (RNGType &rng, U01OODistribution< RealType > &distribution, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_canonical_distribution (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_canonical_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01CanonicalDistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void mckl::internal::u01_canonical_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_cc_distribution (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_cc_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01CCDistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void mckl::internal::u01_cc_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_co_distribution (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_co_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01CODistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void mckl::internal::u01_co_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_distribution (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_oc_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01OCDistribution< RealType >::param_type &)
 
template<typename RealType , typename RNGType >
void mckl::u01_oc_distribution (RNGType &rng, std::size_t n, RealType *r)
 
template<std::size_t K, typename RealType , typename RNGType >
void mckl::internal::u01_oc_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_oo_distribution (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void mckl::u01_oo_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01OODistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void mckl::internal::u01_oo_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 

Macro Definition Documentation

◆ MCKL_DEFINE_RANDOM_U01_DISTRIBUTION

#define MCKL_DEFINE_RANDOM_U01_DISTRIBUTION (   Name,
  name 
)
Value:
template <typename RealType> \
class Name##Distribution \
{ \
MCKL_DEFINE_RANDOM_DISTRIBUTION_ASSERT_REAL_TYPE(Name) \
MCKL_DEFINE_RANDOM_DISTRIBUTION_0(Name, name, RealType) \
MCKL_DEFINE_RANDOM_DISTRIBUTION_MEMBER_0 \
\
public: \
result_type min() const { return 0; } \
\
result_type max() const { return 1; } \
\
void reset() {} \
\
private: \
template <typename RNGType> \
result_type generate(RNGType &rng, const param_type &) \
{ \
using UIntType = \
typename internal::U01UIntType<RNGType, RealType>; \
\
UniformBitsDistribution<UIntType> ubits; \
\
return name<UIntType, result_type>(ubits(rng)); \
} \
};

Definition at line 51 of file u01_distribution.hpp.

◆ MCKL_DEFINE_RANDOM_U01_DISTRIBUTION_IMPL

#define MCKL_DEFINE_RANDOM_U01_DISTRIBUTION_IMPL (   name)
Value:
template <std::size_t K, typename RealType, typename RNGType> \
inline void name##_distribution_impl( \
RNGType &rng, std::size_t n, RealType *r) \
{ \
using UIntType = U01UIntType<RNGType, RealType>; \
\
alignas(MCKL_ALIGNMENT) std::array<UIntType, K> s; \
uniform_bits_distribution(rng, n, s.data()); \
name<UIntType, RealType>(n, s.data(), r); \
}
#define MCKL_ALIGNMENT
The default alignment for scalar type.
Definition: config.h:187

Definition at line 79 of file u01_distribution.hpp.