I am trying to use the MKL random number generator VSL_BRNG_MCG31 to get random numbers from uniform distribution. The multiplier used by the math kernel library seems to be 1132489760 for this generator. But I want random numbers using multiplier397204094. All the other parameterswill bethe same as that of VSL_BRNG_MCG31. How can this be done?
Waiting for your response asap.
With the present version of Intel Math Kernel Libraryyou do not have the opportunity to pass your value of the multiplier into VSL MCG31m1 basic random number generator (BRNG).Asa work-around (which is not likely the approach you need) you coulddevelopyour version of the generator with the required multiplier on your side and register it in MKL VSL usingvslRegisterBrng service functionality (its description is available in MKL Manual, Chapter Statistical functions, section Random Number Generators\Advanced Service Routines).
While the analysis of the feature you asked is necessary on our side it would be helpful if you couldanswer a fewquestions:
1. What is the reason for which the existent multiplierin VSL MCG31m1 does not work for you?
2. Why are you interested in this specific BRNG with relatively small period, ~2^31? Would not other MKL BRNGs like MT19937address your needs?
3. Is this the only MKL BRNGfor which you need to use your values ofBRNG parameters?
For initialization of Intel MKL MT19937 BRNG we use the methodology described in http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html(please, also seeSection 188.8.131.52 in VSLNotes available at http://software.intel.com/sites/products/documentation/hpc/mkl/vsl/vslnotes.pdf).
Theelder methodology for initialization of MT19937 appears to be usedin R projectwhat explains the different outputs you see in R project and in MKL versions of MT19937.
I havemore comments/questions to the code you provided earlier:
1. MKL VSL has two service functions for initialization of random stream, vslNewStream and vslNewStreamEx. Youcanuse the first function if your seed is a scalar, while the secondfunction is intended for those cases when the seed is an array of values. So,instead of call
ierror = vslNewStreamEx(&stream, iRandNumGenerator, iSeedNum, &seed);
you can also use
ierror = vslNewStream(&stream, iRandNumGenerator,seed);
2.You might want to use method VSL_RNG_METHOD_UNIFORMBITS_STD instead of VSL_METHOD_SUNIFORM_STD for generation of random numbers withthe functionviRngUniformBits. The2nd method isintended for generation of single precision variates uniformly distributed on the interval [a,b) (starting with MKL v 10.3 this method is replaced with VSL_RNG_METHOD_UNIFORM_STD)
3. What are the reasons for which you first generate integer output of MT19937 by means of the routine viRngUniformBits and then scale it to the interval [0,1)?As the option, you might want touse vdRngUniform generator which returns the variates uniformly distributed on the interval [a,b).
Please, let me know if this helps to address your questions.