# Engines¶

Random number engines are used for uniformly distributed random numbers generation by using a seed - the initial value that allows to select a particular random number sequence. Initialization is an engine-specific procedure.

Algorithm Input

Engines accept the input described below. Pass the Input ID as a parameter to the methods that provide input for your algorithm. For more details, see Algorithms.

Input ID

Input

tableToFill

Pointer to the numeric table of size $$n \times p$$.

This input can be an object of any class derived from NumericTable except CSRNumericTable, PackedSymmetricMatrix, PackedTriangularMatrix, and MergedNumericTable when it holds one of the above table types.

Algorithm Output

Engines calculate the result described below. Pass the Result ID as a parameter to the methods that access the results of your algorithm. For more details, see Algorithms.

Result ID

Result

randomNumbers

Pointer to the $$n \times p$$ numeric table with generated random floating-point values of single or double precision.

In oneDAL, engines are in-place, which means that the algorithm does not allocate memory for the distribution result, but returns pointer to the filled input.

Note

In the current version of the library, engines are used for random number generation only as a parameter of another algorithm.

Parallel Random Number Generation

The following methods that support generation of sequences of random numbers in parallel are supported in library:

Family

Engines follow the same algorithmic scheme with different algorithmic parameters. The set of the parameters guarantee independence of random number sequences produced by the engines.

The example below demonstrates the idea for the case when 2 engines from the same family are used to generate 2 random sequences:

This method skips nskip elements of the original random sequence. This method allows to produce nThreads non-overlapping subsequences.

The example below demonstrates the idea for the case when 2 subsequences are used from the random sequence:

LeapFrog

This method generates random numbers with a stride of nThreads. threadIdx is an index of the current thread.

The example below demonstrates the idea for the case when 2 subsequences are used from the random sequence:

These methods are represented with member functions of classes that represent functionality described in the Engines section. See API References for details.

Note

Support of these methods is engine-specific.