BookmarkSubscribeRSS Feed
bernhard
Calcite | Level 5

Hi all

I am using this paper http://support.sas.com/resources/papers/proceedings10/109-2010.pdf to parallelize a data step (which is essentially a do loop simulating something).

I wonder what the best approach is to generate random numbers for the multiple threads. Right now I am initizalizing with different seeds "CALL STREAMINIT(&seed.); " where seed is different for each thread/task.

However this is not optimal since the different paths of the Pseudo-RNG could "coincide" after some time (if I am unlucky). Is there any way to improve this situation? Is there any documentation available on the Mersenne Twister configuration in SAS? I am only relying on  RAND in my code.

Thanks

Bernhard

3 REPLIES 3
Rick_SAS
SAS Super FREQ

Yes, in theory you could get unlucky.  In practice I suspect that the probability of getting two streams that are not independent are extremely small. I haven't run the analysis myself, but other people have done what you are proposing and have not reported any dependencies.

If you want to see the literature in this area, search for articles by Piere L'Ecuyer and colleagues on PRNGs that have  provably independent streams.

bernhard
Calcite | Level 5

Thank you Rick.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 482 views
  • 3 likes
  • 3 in conversation