For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

Posts: 525
Joined: Fri Apr 15, 2011 5:35 am


Postby tvonbrasch » Mon May 08, 2023 12:30 am


We have a set of programs that generate some random numbers, but we have trouble creating code so that the same random numbers are generated across different computers. Attached is a set of programs. If you run the master-file (master.prg) you will generate some random numbers in a series X:

2023-05-08 09_15_57-EViews.png
2023-05-08 09_15_57-EViews.png (7.47 KiB) Viewed 170 times

The command:

Code: Select all

rndseed 12345

is included at the top of the master-file. The random numbers in X are generated in the program file: ces_mone_carlo\random_draw_epsilon.

If we rerun the program files on the same computer, the same random numbers are generated. However, if we run the exact same files on a different computer, a different set of variables are generated. What is strange, is that if we move the generation of the series X to lines 13 to 15 in the program (from lines 27 to 29), the program generates the same random numbers in the variable X, even when executed from different computers.
2023-05-08 09_19_26-EViews.png
2023-05-08 09_19_26-EViews.png (14.57 KiB) Viewed 170 times

Is there a bug somewehere, or is it just that we do not understand how the rndseed function works? Or is there another explanation?

Do you have a suggestion on how we can ensure that the same random numbers are generated, irrespective of what type of computer that is used to execute the programs?
(19.54 KiB) Downloaded 8 times

EViews Matt
EViews Developer
Posts: 541
Joined: Thu Apr 25, 2013 7:48 pm

Re: rndseed?

Postby EViews Matt » Tue May 23, 2023 2:21 pm


It appears that you're experiencing a "normal" EViews behavior involving random number generation. A sequence of random numbers generated as part of a series expression is dependent on both the state of the underlying random number generators (influenceable via the 'rndseed' command) and the number of threads used to generate the series (influenceable via the Options -> General Options -> Advanced system options -> "Maximum threads used in statistical calculations" setting). If the later setting differs on two machines, different results may be produced even when 'rndseed' has been issued. You can set the maximum number of threads to 1 on both machines to force generation of consistent random sequences. Alternatively, the next patch will include a new setting to intelligently disable multithreading in the presence of random number functions, allowing the other thread setting to remain as is.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests