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
- Draw Random Numbers into vector

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

Highlighted
Hello,

Tan__Elad

Beginner

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

08-14-2012
07:52 AM

17 Views

Is there a way to call the random number generator with a STL's vector instead of a pointer to an array?

It seems kind of wasteful to copy every time from an array into the vector.

Cheers,

Elad

Accepted Solutions

Highlighted
Hello Elad,

I wonder if this approach (with caution) would work for you

vector v(1000);

...

vdRngGaussian( VSL_RNG_METHOD_GAUSSIAN_ICDF, stream, v.size(), (double*)&v[0], 0.0, 1.0 );

Thanks,

Andrey

Andrey_N_Intel

Employee

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

08-14-2012
10:27 PM

17 Views

I wonder if this approach (with caution) would work for you

vector

...

vdRngGaussian( VSL_RNG_METHOD_GAUSSIAN_ICDF, stream, v.size(), (double*)&v[0], 0.0, 1.0 );

Thanks,

Andrey

2 Replies

Highlighted
Hello Elad,

I wonder if this approach (with caution) would work for you

vector v(1000);

...

vdRngGaussian( VSL_RNG_METHOD_GAUSSIAN_ICDF, stream, v.size(), (double*)&v[0], 0.0, 1.0 );

Thanks,

Andrey

Andrey_N_Intel

Employee

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

08-14-2012
10:27 PM

18 Views

I wonder if this approach (with caution) would work for you

vector

...

vdRngGaussian( VSL_RNG_METHOD_GAUSSIAN_ICDF, stream, v.size(), (double*)&v[0], 0.0, 1.0 );

Thanks,

Andrey

Highlighted

Tan__Elad

Beginner

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

08-20-2012
08:57 AM

17 Views

Worked great!! Thank you!!

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