# Naming Conventions

The names of all VSL functions in FORTRAN are lowercase; names in C may contain both lowercase and uppercase letters.

The names of generator routines have the following structure:

`v<type of result>rng<distribution>` for FORTRAN-interface

`v<type of result>Rng<distribution>` for C-interface,

where v is the prefix of a VSL vector function, and the field <type of result> is either s, d, or i and specifies one of the following types:

s

  REAL for FORTRAN-interface

  float for C-interface

d

  DOUBLE PRECISION for FORTRAN-interface

  double for C-interface

i

  INTEGER for FORTRAN-interface

  int for C-interface

Prefixes s and d apply to continuous distributions only, prefix i applies only to discrete case. The prefix rng indicates that the routine is a random generator, and the <distribution> field specifies the type of statistical distribution.

Names of service routines follow the template below:
`vsl<name>,`

where vsl is the prefix of a VSL service function. The field <name> contains a short function name. For a more detailed description of service routines refer to Service Routines and Advanced Service Routines.

Prototype of each generator routine corresponding to a given probability distribution fits the following structure:
`<function name>( method, stream, n, r, [<distribution parameters >] ),`

where

- method is the number specifying the method of generation. A detailed description of this parameter can be found in Distribution Generators. See the next page for method name structure definition.

- stream defines the random stream descriptor and must have a nonzero value. Random streams and their usage are discussed further in Random Streams and Service Routines.

- n defines the number of random values to be generated. If n is less than or equal to zero, no values are generated. Furthermore, if n is negative, an error condition is set.

- r defines the destination array for the generated numbers. The dimension of the array must be large enough to store at least n random numbers.

Additional parameters included into <distribution parameters> field are individual for each generator routine and are described in detail in Distribution Generators.

To invoke a distribution generator, use a call to the respective VSL routine. For example, to obtain a vector r, composed of n independent and identically distributed random numbers with normal (Gaussian) distribution, that have the mean value a and standard deviation sigma, write the following:

for FORTRAN-interface
`status = vsrnggaussian( method, stream, n, r, a, sigma )`
for C-interface
`status = vsRngGaussian( method, stream, n, r, a, sigma )`
The name of a method parameter has the following structure:
`VSL_METHOD_<precision><distribution>_<method>,`
`VSL_METHOD_<precision><distribution>_<method>_ACCURATE,`

where

<precision>
  S
    for single precision continuous distribution
  D
    for double precision continuous distribution
  I
    for discrete distribution
<distribution>
  probability distribution
<method>
  method name.

Type of name structure for method parameter corresponds to fast and accuarate modes of random number generation (see “Distribution Generators” and VSL Notes for details).

Method names `VSL_METHOD_<precision><distribution>_<method>` and `VSL_METHOD_<precision><distribution>_<method>_ACCURATE` should be used with `vsl<precision>Rng<distribution>` function only, where

<precision>
  s
    for single precision continuous distribution
  d
    for double precision continuous distribution
  i
    for discrete distribution
<distribution>
  probability distribution.

Table“Values of `<method>` in method parameter” provides specific predefined values of the method name. The third column contains names of the functions that use the given method.

Values of `<method>` in method parameter
Method | Short Description | Functions
--- | --- | ---
STD | Standard method. Currently there is only one method for these functions. | Uniform (continuous), Uniform (discrete), UniformBits
BOXMULLER | BOXMULLER generates normally distributed random number x thru the pair of uniformly distributed numbers u1 and u2 according to the formula: | Gaussian, GaussianMV
BOXMULLER2 | BOXMULLER2 generates normally distributed random numbers x1 and x2 thru the pair of uniformly distributed numbers u1 and u2 according to the formulas: | Gaussian, GaussianMV, Lognormal
ICDF | Inverse cumulative distribution function method. | Exponential, Laplace, Weibull, Cauchy, Rayleigh, Gumbel, Bernoulli, Geometric, Gaussian, GaussianMV
GNORM | For α > 1, a gamma distributed random number is generated as a cube of properly scaled normal random number; for 0.6 ≤ α < 1, a gamma distributed random number is generated using rejection from Weibull distribution; for α < 0.6, a gamma distributed random number is obtained using transformation of exponential power distribution; for α = 1, gamma distribution is reduced to exponential distribution. | Gamma
CJA | For `min(p, q) > 1`, Cheng method is used; for `min(p, q) < 1`, Jöhnk method is used, if `q + K·p2+ C ≤ 0` (K= 0.852..., C=-0.956...) otherwise, Atkinson switching algorithm is used; for `max(p, q) < 1`, method of Jöhnk is used; for `min(p, q) < 1, max(p, q)> 1`, Atkinson switching algorithm is used (CJA stands for the first letters of Cheng, Jöhnk, Atkinson); for `p = 1` or `q = 1`, inverse cumulative distribution function method is used;for `p = 1 and q = 1`, beta distribution is reduced to uniform distribution. | Beta
BTPE | Acceptance/rejection method for `ntrial·min(p,1 - p)≥ 30` with decomposition into 4 regions: - 2 parallelograms - triangle - left exponential tail - right exponential tail | Binomial
H2PE | Acceptance/rejection method for large mode of distribution with decomposition into 3 regions: - rectangular - left exponential tail - right exponential tail | Hypergeometric
PTPE | Acceptance/rejection method for λ ≥ 27 with decomposition into 4 regions: - 2 parallelograms - triangle - left exponential tail - right exponential tail; otherwise, table lookup method is used. | Poisson
POISNORM | for λ ≥ 1, method based on Poisson inverse CDF approximation by Gaussian inverse CDF; for λ < 1, table lookup method is used. | Poisson, PoissonV
NBAR | Acceptance/rejection method for , with decomposition into 5 regions: - rectangular - 2 trapezoid - left exponential tail - right exponential tail | NegBinomial

Parent topic: Conventions