Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Select a good seed for random numbers

JohnNichols
Valued Contributor II
339 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 II
335 Views

Capture1.PNG

JohnNichols
Valued Contributor II
334 Views

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

Pavel_D_Intel1
Employee
291 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

Gennady_F_Intel
Moderator
297 Views

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


Reply