thrust
Public Types | Public Member Functions | List of all members
thrust::random::normal_distribution< RealType > Class Template Reference

A normal_distribution random number distribution produces floating point Normally distributed random numbers. More...

#include <thrust/random/normal_distribution.h>

Inherits type< RealType >.

Public Types

typedef RealType result_type
 The type of the floating point number produced by this normal_distribution.
 
typedef thrust::pair< RealType, RealType > param_type
 The type of the object encapsulating this normal_distribution's parameters.
 

Public Member Functions

__host__ __device__ normal_distribution (RealType mean=0.0, RealType stddev=1.0)
 
__host__ __device__ normal_distribution (const param_type &parm)
 
__host__ __device__ void reset (void)
 
template<typename UniformRandomNumberGenerator >
__host__ __device__ result_type operator() (UniformRandomNumberGenerator &urng)
 
template<typename UniformRandomNumberGenerator >
__host__ __device__ result_type operator() (UniformRandomNumberGenerator &urng, const param_type &parm)
 
__host__ __device__ result_type mean (void) const
 
__host__ __device__ result_type stddev (void) const
 
__host__ __device__ param_type param (void) const
 
__host__ __device__ void param (const param_type &parm)
 
__host__ __device__ result_type min THRUST_PREVENT_MACRO_SUBSTITUTION (void) const
 
__host__ __device__ result_type max THRUST_PREVENT_MACRO_SUBSTITUTION (void) const
 

Detailed Description

template<typename RealType = double>
class thrust::random::normal_distribution< RealType >

A normal_distribution random number distribution produces floating point Normally distributed random numbers.

Template Parameters
RealTypeThe type of floating point number to produce.

The following code snippet demonstrates examples of using a normal_distribution with a random number engine to produce random values drawn from the Normal distribution with a given mean and variance:

int main(void)
{
// create a minstd_rand object to act as our source of randomness
// create a normal_distribution to produce floats from the Normal distribution
// with mean 2.0 and standard deviation 3.5
// write a random number to standard output
std::cout << dist(rng) << std::endl;
// write the mean of the distribution, just in case we forgot
std::cout << dist.mean() << std::endl;
// 2.0 is printed
// and the standard deviation
std::cout << dist.stddev() << std::endl;
// 3.5 is printed
return 0;
}

The documentation for this class was generated from the following file: