Template Class normal_distribution
Defined in File rocrand.hpp
Nested Relationships
Nested Types
Class Documentation
-
template<class RealType = float>
class normal_distribution Produces random numbers according to a normal distribution.
- Template Parameters:
RealType – - type of generated values. Only
float
,double
andhalf
types are supported.
Public Functions
-
inline normal_distribution(RealType mean = 0.0, RealType stddev = 1.0)
Constructs a new distribution object.
- Parameters:
mean – - A mean distribution parameter
stddev – - A standard deviation distribution parameter
-
inline normal_distribution(const param_type ¶ms)
Constructs a new distribution object.
- Parameters:
params – - Distribution parameters
-
inline void reset()
Resets distribution’s internal state if there is any.
-
inline RealType mean() const
Returns the mean distribution parameter.
The mean specifies the location of the peak. The default value is 0.0.
-
inline RealType stddev() const
Returns the standard deviation distribution parameter.
The default value is 1.0.
-
inline param_type param() const
Returns the distribution parameter object.
-
inline void param(const param_type ¶ms)
Sets the distribution parameter object.
-
template<class Generator>
inline void operator()(Generator &g, RealType *output, size_t size) Fills
output
with normally distributed random floating-point values.Generates
size
random floating-point values distributed according to a normal distribution, and stores them into the device memory referenced byoutput
pointer.Requirements:
The device memory pointed by
output
must have been previously allocated and be large enough to store at leastsize
values ofRealType
type.Pointer
output
must be aligned to2 * sizeof(RealType)
bytes.size
must be even.If generator
g
is a quasi-random number generator (rocrand_cpp::sobol32_engine
), thensize
must be a multiple of that generator’s dimension.
See also: rocrand_generate_normal(), rocrand_generate_normal_double(), rocrand_generate_normal_half()
- Parameters:
g – - An uniform random number generator object
output – - Pointer to device memory to store results
size – - Number of values to generate
-
inline bool operator==(const normal_distribution<RealType> &other)
Returns
true
if the distribution is the same asother
.Two distribution are equal, if their parameters are equal.
-
inline bool operator!=(const normal_distribution<RealType> &other)
Returns
true
if the distribution is different fromother
.Two distribution are equal, if their parameters are equal.
-
class param_type
The type of the distribution parameter set.
Public Types
-
using distribution_type = normal_distribution<RealType>
Public Functions
-
param_type(const param_type ¶ms) = default
-
inline RealType mean() const
Returns the deviation distribution parameter.
The default value is 1.0.
-
inline RealType stddev() const
Returns the standard deviation distribution parameter.
The default value is 1.0.
-
inline bool operator==(const param_type &other)
Returns
true
if the param_type is the same asother
.
-
inline bool operator!=(const param_type &other)
Returns
true
if the param_type is different fromother
.
-
using distribution_type = normal_distribution<RealType>