32 #ifndef VSMC_RNG_UNIFORM_REAL_DISTRIBUTION_HPP    33 #define VSMC_RNG_UNIFORM_REAL_DISTRIBUTION_HPP    44 template <
typename RealType>
    54 template <
typename RealType>
    67     template <
typename RNGType>
    72         return param.
a() + (param.
b() - param.
a()) * u01(rng);
    79 template <
typename RealType, 
typename RNGType>
    81     RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
    83     u01_distribution<RealType>(rng, n, r);
    84     fma(n, (b - a), r, a, r);
    91 template <
typename RealType, 
typename RNGType>
    93     RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
    95     static_assert(std::is_floating_point<RealType>::value,
    96         "**uniform_real_distribution** USED WITH RealType OTHER THAN FLOATING "    99     const std::size_t k = 1024;
   100     const std::size_t m = n / k;
   101     const std::size_t l = n % k;
   102     for (std::size_t i = 0; i != m; ++i, r += k)
   103         internal::uniform_real_distribution_impl<RealType>(rng, k, r, a, b);
   104     internal::uniform_real_distribution_impl<RealType>(rng, l, r, a, b);
   111 #endif // VSMC_RNG_UNIFORM_REAL_DISTRIBUTION_HPP void uniform_real_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
 
#define VSMC_DEFINE_RNG_DISTRIBUTION_2(Name, name, p1, v1, p2, v2)                    
 
void fma(std::size_t n, const T *a, const T *b, const T *c, T *y)
For , compute . 
 
bool uniform_real_distribution_check_param(RealType a, RealType b)
 
Standard uniform distribution. 
 
#define VSMC_DEFINE_RNG_DISTRIBUTION_RAND_2(Name, name, p1, p2)                          
 
void uniform_real_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generate uniform real random variates with open/closed variants.