Random Number Generator Differences across GAUSS version?

Is it possible for GAUSS version 9 and 16 to generate a different series for a uniform random with a fixed seed of the form:

Version 9:

seed = 1980;

y = 1.5 + (rndus(5,1,seed) - 1);

Version 16 (i):


{ y, seed } = (rndu(5,1,seed) - 1) + 1.5;

Version 16 (ii):

rndseed 1980;

y = (rndu(5,1) - 1) + 1.5;

NOTE: The first expression for version 16 ignores deducting and adding -1 and 1.5 respectively to 5 by 1 matrix. The second expression for 16 take into account the additional operation (-1 and +1.5) after generating the 5 by 1 RNDU matrix.

I need an explanation for the difference in the set of data generated between versions 9 and 16 (ii) commands.

2 Answers


Update: This blog post contains a more complete answer.

Difference between GAUSS 9 and GAUSS 16

GAUSS 9 (and earlier versions) used a 32-bit linear congruential random number generator. Since version 12, the default random number generator in GAUSS is the Mersenne Twister. The Mersenne Twister is a higher quality random number generator with a longer period. So the function rndu (and rndn, etc) WILL return different series of numbers from the same seed.

If you need to reproduce random numbers from an older version of GAUSS, you can either use the function _rndu, or rndLCu. (NOTE: for backwards compatibility, _rndn and rndLCn are available for random normal numbers. However, in GAUSS 10 an improvement was made in the algorithm to make the random numbers normally distributed, so they will not be identical to versions before 10.)

GAUSS 16 code snippets

The reason that your two code snippets for GAUSS 16 do not produce the same number is that they are not equivalent. You cannot apply an expression to a function call that returns more than 1 item. Here are equivalent expressions:

rndseed 1980;
y = (rndu(5,1) - 1) + 1.5;
seed = 1980;
{ y, state } = rndu(5,1, seed);
y = (y - 1) + 1.5;



You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy