how to generate random numbers over [0.0, 1.0) with MKL VSL

how to generate random numbers over [0.0, 1.0) with MKL VSL

Hi, everyone!

The basic random number generators in MKL VSL can distribute the numbers within [0.0, 1.0], but how to generate random numbers over [0.0, 1.0)?

Thanks in advance!

CPU: Intel Core 2 Duo 2.4 GHz OS: Mac OS X 10.5.8 Linux: Debian 5.0 x86_64 Compiler: Intel Fortran Compiler 11.1 & Intel C++ Compiler 11.1 (with Intel MKL included)
4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

Basic RNGs in Intel(R) MKL VSL return numbers uniformly distributed on the interval [0,1), that is "1" is not included in the interval. Please, let me know if this answers your question.

Andrey

 

Hi, Andrey

Quote:

Andrey Nikolaev (Intel) wrote:

Hi,

Basic RNGs in Intel(R) MKL VSL return numbers uniformly distributed on the interval [0,1), that is "1" is not included in the interval. Please, let me know if this answers your question.

Andrey

 

According to Intel Math Kernel Library Reference Manual (Document Number: 630813-055US), 'vsrnguniform' and 'vdrnguniform' can produce "random numbers uniformly distributed over the intervel [a, b]" (Page 2664). So, I don't think I can get random numbers within [0, 1) by using these functions. However, I just found 'virnguniform' can generate integer "random numbers uniformly distributed over the interval [a, b)" (Page 2698). I could use 'virnguniform' to find an integer first, and then divide it by 'b' for a random floating point number in [0, 1).

CPU: Intel Core 2 Duo 2.4 GHz OS: Mac OS X 10.5.8 Linux: Debian 5.0 x86_64 Compiler: Intel Fortran Compiler 11.1 & Intel C++ Compiler 11.1 (with Intel MKL included)

Hi, this is inaccuracy in the documentation. It should be fixed in one of future MKL releases. So, it makes sense to use v[s|d]rnguniform function. Thanks, Andrey

Login to leave a comment.