RNRAL

Generates pseudorandom numbers from a Rayleigh distribution.

Required Arguments

ALPHA — Parameter of the Rayleigh distribution. (Input)
ALPHA must be greater than 0.

R — Vector of length NR containing the random Rayleigh deviates. (Output)

Optional Arguments

NR — Number of random numbers to generate. (Input)
Default: NR = size (R,1).

FORTRAN 90 Interface

Generic: CALL RNRAL (ALPHA, R [])

Specific: The specific interface names are S_RNRAL and D_RNRAL.

FORTRAN 77 Interface

Single: CALL RNRAL (NR, ALPHA, R)

Double: The double precision name is DRNRAL.

Description

Routine RNRAL generates pseudorandom numbers from a Rayleigh distribution (see Chapter 17, “Probability Distribution Function and Inverses”, routine RALDF).

Comments

The routine RNSET can be used to initialize the seed of the random number generator. The routine RNOPT can be used to select the form of the generator.

Example

In this example, RNRAL is used to generate five pseudorandom deviates from a Rayleigh distribution with parameter ALPHA = 0.5.

 

USE UMACH_INT

USE RNRAL_INT

IMPLICIT NONE

INTEGER NR

PARAMETER (NR=5)

INTEGER NOUT

REAL ALPHA, R(NR)

CALL UMACH(2, NOUT)

CALL RNSET(123457)

ALPHA = 0.5

CALL RNRAL(ALPHA, R)

WRITE (NOUT, 99999) R

99999 FORMAT (' Rayleigh random deviates: ', 5F10.4)

END

Output

 

Rayleigh random deviates: 0.1311 0.8199 0.3648 0.5307 0.2904