# Independent Streams. Leapfrogging and Block-Splitting

One of the basic requirements for random number streams is their mutual independence and lack of intercorrelation. Even if you want random number samplings to be correlated, such correlation should be controllable.

You can get independent streams using various methods. This document discusses the following methods supported by VSL:

# Abstract Basic Random Number Generators. Abstract Streams

If you want to use a BRNG not included in VSL together with VSL distribution generators, you can register your generator using the vslRegisterBrng function. In this case, your own BRNG should meet VSL BRNG interface requirements. Otherwise, you can use VSL abstract BRNGs as a wrapper.

Caution

# Generating Methods for Random Numbers of Non-Uniform Distribution

You can use a source of uniformly distributed random numbers to generate both discrete and continuous distributions, which is implemented through a number of methods briefly described below.

# Inverse Transformation

The probability distribution of a one-dimensional variate X may be most generally presented in terms of cumulative distribution function (CDF):

.

Any CDF is defined on the whole real axis and is monotonically increasing, where

# Acceptance/Rejection

The cumulative distribution functions and their inverses may often be much more complex computationally than the probability density function (for continuous distributions) and the probability mass function (for discrete distributions).

# Mixture of Distributions

You can split the initial distribution into several simpler distributions:

In this case, random numbers for each of the distributions Fi(x) are easy to generate. An appropriate algorithm may be as follows:

# Special Properties

To improve the efficiency of the algorithms based on the general methods described above, you may have to use special properties of distributions. For example, use of polar coordinates for a pair of independent normal variates enables you to develop an efficient method of random number generation based on 2D inverse transformation known as the Box-Muller method:

# Accurate and Fast Modes of Random Number Generation

Using the distribution generators in the application, you can expect the obtained random numbers to belong to definitional domain of the corresponding distribution irrespective of its parameters.

# Example of VSL Use

A typical algorithm for VSL generators is as follows:

1. Create and initialize a stream/streams. You can use functions vslNewStream, vslNewStreamEx, vslCopyStream, vslCopyStreamState, vslLeapfrogStream, vslSkipAheadStream.

2. Call one or more RNGs.

# Testing of Basic Random Number Generators

This section provides information on testing the Basic Random Number Generators (BRNG), including details on BRNG properties and categories, as well as on interpretation of test results.