|
R123_CUDA_DEVICE R123_STATIC_INLINE void | sincospif (float x, float *s, float *c) |
|
R123_CUDA_DEVICE R123_STATIC_INLINE void | sincospi (double x, double *s, double *c) |
|
R123_CUDA_DEVICE R123_STATIC_INLINE float2 | boxmuller (uint32_t u0, uint32_t u1) |
|
R123_CUDA_DEVICE R123_STATIC_INLINE double2 | boxmuller (uint64_t u0, uint64_t u1) |
|
template<typename Ftype , typename Itype > |
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype | u01 (Itype in) |
| Return a uniform real value in (0, 1]. More...
|
|
template<typename Ftype , typename Itype > |
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype | uneg11 (Itype in) |
| Return a signed value in [-1,1]. More...
|
|
template<typename Ftype , typename Itype > |
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype | u01fixedpt (Itype in) |
| Return a value in (0,1) chosen from a set of equally spaced fixed-point values. More...
|
|
Most of the Random123 C++ API is contained in the r123 namespace.
template<typename Ftype , typename Itype >
Return a uniform real value in (0, 1].
@ingroup uniform
Input is a W-bit integer (signed or unsigned). It is cast to
a W-bit unsigned integer, multiplied by Ftype(2^-W) and added to
Ftype(2^(-W-1)). A good compiler should optimize it down to an
int-to-float conversion followed by a multiply and an add, which
might be fused, depending on the architecture.
If the input is a uniformly distributed integer, and if Ftype
arithmetic follows IEEE754 round-to-nearest rules, then the
result is a uniformly distributed floating point number in (0, 1].
- The result is never exactly 0.0.
- The smallest value returned is 2^-(W-1).
- Let M be the number of mantissa bits in Ftype (typically 24 or 53).
- If W>M then the largest value retured is 1.0.
- If W<=M then the largest value returned is Ftype(1.0 - 2^(-W-1)).
Definition at line 189 of file uniform.hpp.
template<typename Ftype , typename Itype >
Return a signed value in [-1,1].
@ingroup uniform
The argument is converted to a W-bit signed integer, multiplied by Ftype(2^-(W-1)) and
then added to Ftype(2^-W). A good compiler should optimize
it down to an int-to-float conversion followed by a multiply and
an add, which might be fused, depending on the architecture.
If the input is a uniformly distributed integer, and if Ftype arithmetic follows IEEE754 round-to-nearest rules, then the output is a uniformly distributed floating point number in [-1, 1].
- The result is never exactly 0.0.
- The smallest absolute value returned is 2^-W
- Let M be the number of mantissa bits in Ftype.
- If W>M then the largest value retured is 1.0 and the smallest is -1.0.
- If W<=M then the largest value returned is the Ftype(1.0 - 2^-W) and the smallest value returned is -Ftype(1.0 - 2^-W).
Definition at line 221 of file uniform.hpp.