help me .

help me .


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" ?


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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,
Description of various distribution generators, basic random number generators and methods of their application is also available there. VSL performance data is contained at


thank you Andrey!

Leave a Comment

Please sign in to add a comment. Not a member? Join today