Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Basic Generators

VS provides pseudorandom, quasi-random, and non-deterministic random number generators. This includes the following BRNGs, which differ in speed and other properties:

  • the 31-bit multiplicative congruential pseudorandom number generator MCG(1132489760, 231 -1) [L'Ecuyer99]

  • the 32-bit generalized feedback shift register pseudorandom number generator GFSR(250,103) [Kirkpatrick81]

  • the combined multiple recursive pseudorandom number generator MRG32k3a [L'Ecuyer99a]

  • the 59-bit multiplicative congruential pseudorandom number generator MCG(1313, 259) from NAG Numerical Libraries [NAG]

  • Wichmann-Hill pseudorandom number generator (a set of 273 basic generators) from NAG Numerical Libraries [NAG]

  • Mersenne Twister pseudorandom number generator MT19937 [Matsumoto98] with period length 219937-1 of the produced sequence

  • Set of 6024 Mersenne Twister pseudorandom number generators MT2203 [Matsumoto98], [Matsumoto00]. Each of them generates a sequence of period length equal to 22203-1. Parameters of the generators provide mutual independence of the corresponding sequences.

  • SIMD-oriented Fast Mersenne Twister pseudorandom number generator SFMT19937 [Saito08] with a period length equal to 219937-1 of the produced sequence.

  • Sobol quasi-random number generator [Sobol76], [Bratley88], which works in arbitrary dimension. For dimensions greater than 40 the user should supply initialization parameters (initial direction numbers and primitive polynomials or direction numbers) by using vslNewStreamEx function. See additional details on interface for registration of the parameters in the library in VS Notes.

  • Niederreiter quasi-random number generator [Bratley92], which works in arbitrary dimension. For dimensions greater than 318 the user should supply initialization parameters (irreducible polynomials or direction numbers) by using vslNewStreamEx function. See additional details on interface for registration of the parameters in the library in VS Notes.

  • Non-deterministic random number generator (RDRAND-based generators only) [AVX], [IntelSWMan].

    NOTE:

    You can use a non-deterministic random number generator only if the underlying hardware supports it. For instructions on how to detect if an Intel CPU supports a non-deterministic random number generator see, for example, Chapter 8: Post-32nm Processor Instructions in [AVX] or Chapter 4: RdRand Instruction Usage in [BMT].

    NOTE:

    The time required by some non-deterministic sources to generate a random number is not constant, so you might have to make multiple requests before the next random number is available. VS limits the number of retries for requests to the non-deterministic source to 10. You can redefine the maximum number of retries during the initialization of the non-deterministic random number generator with the vslNewStreamEx function.

    For more details on the non-deterministic source implementation for Intel CPUs please refer to Section 7.3.17, Volume 1, Random Number Generator Instruction in [IntelSWMan] and Section 4.2.2, RdRand Retry Loop in [BMT].

  • Philox4x32-10 counter-based pseudorandom number generator with a period of 2128PHILOX4X32X10[Salmon11].

  • ARS-5 counter-based pseudorandom number generator with a period of 2128, which uses instructions from the AES-NI set ARS5[Salmon11].

See some testing results for the generators in VS Notes and comparative performance data at https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-documentation.html.

VS provides means of registration of such user-designed generators through the steps described in Advanced Service Routines.

For some basic generators, VS provides two methods of creating independent random streams in multiprocessor computations, which are the leapfrog method and the block-splitting method. These sequence splitting methods are also useful in sequential Monte Carlo.

In addition, MT2203 pseudorandom number generator is a set of 6024 generators designed to create up to 6024 independent random sequences, which might be used in parallel Monte Carlo simulations. Another generator that has the same feature is Wichmann-Hill. It allows creating up to 273 independent random streams. The properties of the generators designed for parallel computations are discussed in detail in [Coddington94].

You may want to design and use your own basic generators. VS provides means of registration of such user-designed generators through the steps described in Advanced Service Routines.

There is also an option to utilize externally generated random numbers in VS distribution generator routines. For this purpose VS provides three additional basic random number generators:

  • for external random data packed in 32-bit integer array

  • for external random data stored in double precision floating-point array; data is supposed to be uniformly distributed over (a,b) interval

  • for external random data stored in single precision floating-point array; data is supposed to be uniformly distributed over (a,b) interval.

Such basic generators are called the abstract basic random number generators.

See VS Notes for a more detailed description of the generator properties.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201