Page 1 of 1

rndseed?

Posted: Mon May 08, 2023 12:30 am
by tvonbrasch
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 20548 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 20548 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

Re: rndseed?

Posted: Tue May 23, 2023 2:21 pm
by EViews Matt
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.

Re: rndseed?

Posted: Tue May 30, 2023 10:15 pm
by tvonbrasch
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# ... dseed.html

t

Re: rndseed?

Posted: Wed May 31, 2023 3:13 pm
by EViews Matt
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.

Re: rndseed?

Posted: Wed May 31, 2023 11:22 pm
by tvonbrasch
Okay, great, thanks!
t