Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Select a good seed for random numbers

JohnNichols
Valued Contributor III
1,326 Views

Does anybody have an idea as to the best method of picking a random seed so I get different random numbers each time -- 

TYPE (VSL_STREAM_STATE) :: stream

      n=1000000
      nn=10

      brng=VSL_BRNG_MCG31
      method=VSL_RNG_METHOD_GAUSSIAN_ICDF
      seed=777

      a=0.0
      sigma=1.0

!     ***** Initialize *****
      errcode=vslnewstream( stream, brng,  seed )
      call CheckVslError(errcode)

!     ***** Call RNG *****
      errcode=vdrnggaussian( method, stream, n, r, a, sigma)
      call CheckVslError(errcode)
0 Kudos
4 Replies
JohnNichols
Valued Contributor III
1,322 Views

Capture1.PNG

0 Kudos
JohnNichols
Valued Contributor III
1,321 Views

Re: This is not random from the program -- it has strong patterns - visible by eye

0 Kudos
Pavel_D_Intel1
Employee
1,278 Views

Hi John,

 

Could you please clarify the problem a little bit – am I right that you don’t like a statistics of random numbers produced by MCG31M1 basic random number generator?

Actually this generator is one of the generators of the linear-congruential family that have quite simple algorithm of the state adjustment.

I can recommend to use modern generators form the Mersenne Twister family: MT19937/MT2203 or from the counter-based family: PHILOX4X32X10 / ARS5.

Best regards,
Pavel

0 Kudos
Gennady_F_Intel
Moderator
1,284 Views

ok, we will ask RNG owners to look at this case and they will help to recognize the problem.


0 Kudos
Reply