Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
17 Views

Draw Random Numbers into vector

Jump to solution
Hello,
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
0 Kudos

Accepted Solutions
Highlighted
Employee
17 Views
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

View solution in original post

0 Kudos
2 Replies
Highlighted
Employee
18 Views
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

View solution in original post

0 Kudos
Highlighted
Beginner
17 Views
Worked great!! Thank you!!
0 Kudos