32 #ifndef VSMC_RNG_U01_DISTRIBUTION_HPP    33 #define VSMC_RNG_U01_DISTRIBUTION_HPP    45 template <
typename RNGType>
    46 using U01UIntType = 
typename std::conditional<(RNGBits<RNGType>::value > 32),
    53 template <
typename RealType>
    57         U01, u01, RealType, floating_point, FLOATING_POINT)
    67     template <
typename RNGType>
    70         return u01_co<internal::U01UIntType<RNGType>, 
result_type>(
    77 template <
typename RealType>
    81         U01CC, 
u01_cc, RealType, floating_point, FLOATING_POINT)
    91     template <
typename RNGType>
    94         return u01_cc<internal::U01UIntType<RNGType>, 
result_type>(
   101 template <
typename RealType>
   105         U01CO, 
u01_co, RealType, floating_point, FLOATING_POINT)
   115     template <
typename RNGType>
   118         return u01_co<internal::U01UIntType<RNGType>, 
result_type>(
   125 template <
typename RealType>
   129         U01OC, 
u01_oc, RealType, floating_point, FLOATING_POINT)
   139     template <
typename RNGType>
   142         return u01_oc<internal::U01UIntType<RNGType>, 
result_type>(
   149 template <
typename RealType>
   153         U01OO, 
u01_oo, RealType, floating_point, FLOATING_POINT)
   163     template <
typename RNGType>
   166         return u01_oo<internal::U01UIntType<RNGType>, 
result_type>(
   174 template <std::
size_t K, 
typename RealType, 
typename RNGType>
   179     u01_co<U01UIntType<RNGType>, RealType>(n, s, r);
   182 template <std::
size_t K, 
typename RealType, 
typename RNGType>
   187     u01_cc<U01UIntType<RNGType>, RealType>(n, s, r);
   188     for (std::size_t i = 0; i != n; ++i)
   192 template <std::
size_t K, 
typename RealType, 
typename RNGType>
   197     u01_co<U01UIntType<RNGType>, RealType>(n, s, r);
   200 template <std::
size_t K, 
typename RealType, 
typename RNGType>
   205     u01_oc<U01UIntType<RNGType>, RealType>(n, s, r);
   208 template <std::
size_t K, 
typename RealType, 
typename RNGType>
   213     u01_oo<U01UIntType<RNGType>, RealType>(n, s, r);
   220 template <
typename RealType, 
typename RNGType>
   223     static_assert(std::is_floating_point<RealType>::value,
   224         "**u01_distribution** USED WITH RealType OTHER THAN FLOATING POINT "   227     const std::size_t k = 1024;
   228     const std::size_t m = n / k;
   229     const std::size_t l = n % k;
   230     for (std::size_t i = 0; i != m; ++i, r += k)
   231         internal::u01_distribution_impl<k>(rng, k, r);
   232     internal::u01_distribution_impl<k>(rng, l, r);
   237 template <
typename RealType, 
typename RNGType>
   240     static_assert(std::is_floating_point<RealType>::value,
   241         "**u01_cc_distribution** USED WITH RealType OTHER THAN FLOATING POINT "   244     const std::size_t k = 1024;
   245     const std::size_t m = n / k;
   246     const std::size_t l = n % k;
   247     for (std::size_t i = 0; i != m; ++i, r += k)
   248         internal::u01_cc_distribution_impl<k>(rng, k, r);
   249     internal::u01_cc_distribution_impl<k>(rng, l, r);
   254 template <
typename RealType, 
typename RNGType>
   257     static_assert(std::is_floating_point<RealType>::value,
   258         "**u01_co_distribution** USED WITH RealType OTHER THAN FLOATING POINT "   261     const std::size_t k = 1024;
   262     const std::size_t m = n / k;
   263     const std::size_t l = n % k;
   264     for (std::size_t i = 0; i != m; ++i, r += k)
   265         internal::u01_co_distribution_impl<k>(rng, k, r);
   266     internal::u01_co_distribution_impl<k>(rng, l, r);
   271 template <
typename RealType, 
typename RNGType>
   274     static_assert(std::is_floating_point<RealType>::value,
   275         "**u01_oc_distribution** USED WITH RealType OTHER THAN FLOATING POINT "   278     const std::size_t k = 1024;
   279     const std::size_t m = n / k;
   280     const std::size_t l = n % k;
   281     for (std::size_t i = 0; i != m; ++i, r += k)
   282         internal::u01_oc_distribution_impl<k>(rng, k, r);
   283     internal::u01_oc_distribution_impl<k>(rng, l, r);
   288 template <
typename RealType, 
typename RNGType>
   291     static_assert(std::is_floating_point<RealType>::value,
   292         "**u01_oo_distribution** USED WITH RealType OTHER THAN FLOATING POINT "   295     const std::size_t k = 1024;
   296     const std::size_t m = n / k;
   297     const std::size_t l = n % k;
   298     for (std::size_t i = 0; i != m; ++i, r += k)
   299         internal::u01_oo_distribution_impl<k>(rng, k, r);
   300     internal::u01_oo_distribution_impl<k>(rng, l, r);
   311 #endif // VSMC_RNG_U01_HPP 
RealType u01_oo(UIntType u) noexcept
Convert uniform unsigned integers to floating points on (0, 1) 
 
#define VSMC_DEFINE_RNG_DISTRIBUTION_RAND_0(Name, name, T)                                    
 
#define VSMC_DEFINE_RNG_DISTRIBUTION_0(Name, name, T, t, Type)                            
 
Standard uniform distribution on (0, 1]. 
 
void u01_oo_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on (0, 1) 
 
typename std::conditional<(RNGBits< RNGType >::value > 32), std::uint64_t, std::uint32_t >::type U01UIntType
 
RealType u01_co(UIntType u) noexcept
Convert uniform unsigned integers to floating points on [0, 1) 
 
void u01_distribution(RNGType &, std::size_t, RealType *)
Generate standard uniform random variates. 
 
Standard uniform distribution on (0, 1) 
 
void u01_oo_distribution_impl(RNGType &rng, std::size_t n, RealType *r)
 
void u01_co_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on [0, 1) 
 
RealType u01_oc(UIntType u) noexcept
Convert uniform unsigned integers to floating points on (0, 1]. 
 
RealType u01_cc(UIntType u) noexcept
Convert uniform unsigned integers to floating points on [0, 1]. 
 
Standard uniform distribution on [0, 1]. 
 
void u01_oc_distribution_impl(RNGType &rng, std::size_t n, RealType *r)
 
void u01_cc_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on [0, 1]. 
 
void u01_cc_distribution_impl(RNGType &rng, std::size_t n, RealType *r)
 
void uniform_bits_distribution(RNGType &, std::size_t, UIntType *)
 
Standard uniform distribution. 
 
void u01_co_distribution_impl(RNGType &rng, std::size_t n, RealType *r)
 
void u01_oc_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on (0, 1]. 
 
void u01_distribution_impl(RNGType &rng, std::size_t n, RealType *r)
 
Standard uniform distribution on [0, 1)