- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My English writing is poor since I am not an American ( reading is good:).
I want to do a simulation including 500 loops.that means I must generate random normal distribution vectors for 500 times.I know myself can generate them by calling vslnewstream subroutine for 500 times and giving 500 random seeds. But maybe this isn't what I want.
I used VNI's imsl library before and only one random seed is needed in spite of how many distribution vectors I generate.if someone ask me : what is your program's random seed? ,I will tell him the number.
It is wrong to tell him more than one random seed.can I get 500 distribution vectors from one vsl stream? and I want to know : what is " stream state" ?
thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your questions.
In order to generate 500 Gaussian vectors it is enough to create random stream one time only. Random stream is initialized by identificator of a basic random number generator and seed (number or array of numbers). After initialization of the random stream you can generate as much random number vectors of required distribution as you want. Before termination of your program you need to free resources allocated for random stream.
For your convenience piece of code below demonstrates generation of 551 vectors of 1000 Gaussian random numbers.
....
int i;
float r[1000];
VSLStreamStatePtr stream;
/* Initialization of the stream */
vslNewStream( &stream, VSL_BRNG_MCG31, 7777777 );
/* Generation of 551 random vectors of 1000 normally distributed random numbers */
for ( i = 0; i < 551; i++ )
{
/* Generation of array of 1000 normally distributed random numbers */
vsRngGaussian( 0, stream, 1000, r, 0.0f, 1.0f );
/ * Do other stuff */
}
....
/* Deinitialization */
vslDeleteStream( &stream );
....
You can find detailed information about conception of random stream, its state and properties in vsl notes,http://www.intel.com/software/products/mkl/docs/vslnotes.pdf.
Description of various distribution generators, basic random number generators and methods of their application is also available there. VSL performance data is contained at http://www.intel.com/software/products/mkl/data/vsl/vsl_performance_data.htm.
Thanks,
Andrey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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