Resources

Rndseed or rndcon?

1

Suppose,

rndseed 34567;
xx = rndn(50,1);

for i (1,100,1);
   yy = rndn(50,1);
   j = 1; 
   do while j <= 1000;
      zz = rndn(50,1);
      j = j + 1; 
   endo;
endfor;

I want "xx" stay the same whenever I run the program. But "yy" and "zz" have to be different. The used of "rndseed" makes all the three have similar values.

Tags: asked October 3, 2012

1 Answer

0

In GAUSS 12 and newer versions rndn has an optional input of a state or seed, so your could change your program easily to this:

seed = 34567;
{ xx, state } = rndn(50,1, seed);

for i (1,100,1);
   yy = rndn(50,1);
   j = 1; 
   do while j ≤ 1000;
      zz = rndn(50,1);
      j = j + 1; 
   endo;
endfor;

In older versions of GAUSS you can use the rndLCn function instead of adding the seed input to rndn (which will still work in the current version as well) .

aptech
352