rndseed?

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

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

rndseed?

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

Hi,

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 5210 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 5210 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?
t
Attachments
monte_carlo_analysis.zip
(19.54 KiB) Downloaded 60 times

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

Re: rndseed?

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

Hello,

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.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: rndseed?

Postby tvonbrasch » Tue May 30, 2023 10:15 pm

Hi,

Great, thanks, Matt.

Where can I find more information about this new option?

It is not yet in this link:
https://eviews.com/help/helpintro.html#page/content%2Fcommandcmd-rndseed.html

t

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

Re: rndseed?

Postby EViews Matt » Wed May 31, 2023 3:13 pm

Hello,

The new setting isn't in the documentation quite yet, but you can find it in the settings dialog: Options -> General Options -> Advanced system options -> "Reproducible random number sequences in series expressions". It's a global setting, not an option to 'rndseed' or another command.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: rndseed?

Postby tvonbrasch » Wed May 31, 2023 11:22 pm

Okay, great, thanks!
t


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 15 guests