Community
cancel
Showing results for 
Search instead for 
Did you mean: 
mgaro
Beginner
47 Views

Random numbers on half-open interval

Hello there,
is it possible to use the vdrnguniform routine to generate random numbers, e.g., in the half-openinterval (0,1]? I want to exclude zero (because this may cause a division by zero) without biasing the RNG in any other way.
Thanks in advance!
mgaro
0 Kudos
2 Replies
Andrey_N_Intel
Employee
47 Views

Hello Mgaro,
Intel MKL version of Uniform generator v[d|s]RngUniform( method, stream, n, r, a, b )allows generating n numbers uniformly distributed on interval [a, b). By proper setting value of ayou would be able to generate random numbers separated from zero. For example, if you use MT19937 BRNG underneath, please set value of a to L/M wherewhere Lis a positive integer, e.g, 1, and M is 2^32. Generally, value of M is defined by type of BRNG (e.g., for MCG59 value of M is equal to 2^59).Please, let me know if thisapproach works for you.
Best,
Andrey
mgaro
Beginner
47 Views

Dear Andrey,
thanks a lot, this is exactly what I was looking for! I tried the same kind of workaround but I wasn't sure how to determine the lower bound now I know (I'm using the MT19937). It works perfectly fine with 2^-32.
Thanks again!
Best,
mgaro