# rayleigh¶

Class is used for generation of Rayleigh distributed real types random numbers.

Description

The class object is used in the oneapi::mkl::rng::generate() function to provide random numbers Rayleigh distributed with displacement $$a$$, and scalefactor $$(b, \beta)$$, where $$a, \beta \in R; \beta > 0$$.

The Rayleigh distribution is a special case of the weibull distribution, where the shape parameter alpha = 2 .

The probability distribution is given by:

$\begin{split}f_{a, \beta}(x) = \left\{ \begin{array}{rcl} \frac{2(x - a)}{\beta^2}exp(-\frac{(x - a)^2)}{\beta^2}), x \ge a \\ 0, x < a \end{array}\right.\end{split}$

The cumulative distribution function is as follows:

$\begin{split}F_{a, \beta}(x) = \left\{ \begin{array}{rcl} 1 - exp(-\frac{(x - a)^2)}{\beta^2}), x \ge a \\ 0, x < a \end{array}\right.\end{split}$

## class rayleigh¶

Syntax

namespace oneapi::mkl::rng {
template<typename RealType = float, typename Method = rayleigh_method::by_default>
class rayleigh {
public:
using method_type = Method;
using result_type = RealType;
rayleigh();
explicit rayleigh(RealType a, RealType b);
RealType a() const;
RealType b() const;
};
}

Template parameters

typename RealType
Type of the produced values. Supported types:
• float

• double

typename Method = oneapi::mkl::rng::rayleigh_method::by_default

Transformation method, which will be used for generation. Supported types:

• oneapi::mkl::rng::rayleigh_method::by_default

• oneapi::mkl::rng::rayleigh_method::icdf

• oneapi::mkl::rng::rayleigh_method::icdf_accurate

See description of the methods in Distributions methods template parameter.

Class Members

Routine

Description

rayleigh()

Default constructor

explicit rayleigh(RealType a, RealType b)

Constructor with parameters

RealType a() const

Method to obtain displacement value

RealType b() const

Method to obtain scalefactor value

Member types

rayleigh::method_type = Method

Description

The type which defines transformation method for generation.

rayleigh::result_type = RealType

Description

The type which defines type of generated random numbers.

Constructors

rayleigh::rayleigh()

Description

Default constructor for distribution, parameters set as a = 0.0, and b = 1.0.

explicit rayleigh::rayleigh(RealType a, RealType b)

Description

Constructor with parameters. a is a displacement value, b is a scalefactor value.

Throws

oneapi::mkl::invalid_argument

Exception is thrown when $$b \leq$$ static_cast<RealType>(0.0)

Characteristics

RealType rayleigh::a() const

Return Value

Returns the distribution parameter a - displacement value.

RealType rayleigh::b() const

Return Value

Returns the distribution parameter b - scalefactor value.

Parent topic: Distributions