Hi,
I have developed a function to generate a vector of random numbers. However, there are two problems:
1. When the number of random numbers to be generated is too large (e.g. 50000^2), it will output: MKL ERROR: Parameter 3 was incorrect on entry to vdRngUniform.
2. When the left bound is a positive number (i.e. a = 300 b = 100), the function violates the left bound condition and returns minimum value of zero! However, if 'a' is a negative number, it works correctly!
Can you please help? Thank you.
Afshin
int RNG_UNIF ( long int N, double a, double b, double *P ) { // N number of random values to be generated // a is the left bound // b is the right bound VSLStreamStatePtr stream; int errcode = 0; srand(time(0)); long seed = rand(); /***** Initialize *****/ errcode = vslNewStream( &stream, VSL_BRNG_MT2203, seed ); if (errcode != 0) goto err; /***** Call RNG *****/ errcode = vdRngUniform( VSL_RNG_METHOD_UNIFORM_STD_ACCURATE, stream, N, P, a, b ); if (errcode != 0) goto err; vslDeleteStream(&stream); err: return errcode; }