Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- Random numbers on half-open interval

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

mgaro

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-24-2011
01:35 AM

47 Views

Random numbers on half-open interval

is it possible to use the vdrnguniform routine to generate random numbers, e.g., in the **half-open**interval (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

Link Copied

2 Replies

Andrey_N_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-24-2011
05:41 AM

47 Views

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-24-2011
07:02 AM

47 Views

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

For more complete information about compiler optimizations, see our Optimization Notice.