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

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- random number generators

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

stansy

Beginner

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

03-08-2013
01:47 PM

44 Views

random number generators

Hi,

Why the first element of the vector is generated from the distribution with the mean value equal to 0.0. How should I correct this code:

void RNorm(int n ,float *x ,float mu=100.0f, float sigma=1.0f)

{

VSLStreamStatePtr stream;

vslNewStream( &stream, VSL_BRNG_MCG31, 777);

// vsRngGaussian( VSL_METHOD_SGAUSSIAN_BOXMULLER2, stream, 1, x, mu, sigma ); //if I use this line the result will be correct

vsRngGaussian( VSL_METHOD_SGAUSSIAN_BOXMULLER2, stream, n, x, mu, sigma );

vslDeleteStream( &stream );

}

Thanks,

Stan

Link Copied

3 Replies

Gennady_F_Intel

Moderator

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

03-08-2013
09:02 PM

44 Views

here what i see with this generator when n == 11 elements:( mkl 11.0.update2)

1.exe

mu == 100.000000

X[0] == 94.557526

X[1] == 100.209007

X[2] == 98.103668

X[3] == 101.462799

X[4] == 99.835510

X[5] == 100.047592

X[6] == 100.162888

X[7] == 100.772491

X[8] == 100.407875

X[9] == 98.523254

X[10] == 99.375008

Andrey_N_Intel

Employee

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

03-12-2013
03:26 AM

44 Views

Hello Stan,

Please, have a look at the paper which describes some aspects of initialization (seed'ing) of random number generators in Intel(R) Math Kernel Library, http://software.intel.com/en-us/articles/initializing-Intel-MKL-BRNGs/

Does it answer your question?

Thanks,

Andrey

stansy

Beginner

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

03-12-2013
10:24 AM

44 Views

Hello Andrey,

Thank you very much for your help. I have not read this document before but intuitively applied to the tips outlined in it.

With greetings,

Stan

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

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