Rndseed or rndcon?

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.

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

1,773

Your Answer

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) .


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.