How to generate multiple draws using a non-default random number generator

I would like to use one of the optional random number generators in GAUSS (mrg32k3a, Wichmann-Hill, MT2203, etc). I see from the documentation that I can create a state vector for one of these like this:

seed = 889080234;
state_1 = rndCreateState("mrg32k3a", seed);

I understand that when I pass this state variable into one of the GAUSS random number functions, it will create a sequence using the mrg32k3a. For example:

{ r_1, state_2 } = rndn(100, 1, state_1);

However, if take the state vector that is returned by this call and pass it into rndn will this second call still be using the mrg32k3a? For example:

{ r_2, state_3 } = rndn(100, 1, state_2);

1 Answer



0



Yes, the state vector determines which underlying generator the function will use. The random number generating functions in GAUSS will always return the same type of state vector which was passed in. So both r_1 and r_2 in your example will be created using the mrg32k3a.

However, if you do NOT pass in a state vector, then GAUSS will use an internally handled state vector which uses the default generator (Mersenne-Twister). For example:

state_1 = rndCreateState("mrg32k3a", 54443);

//Use the 'mrg32k3a'
{ r_1, state_1 } = rndn(100, 1);

//Use the internally managed state vector
//which defaults to the Mersenne-Twister
r_2 = rndn(100, 1);

aptech

1,773

Your Answer

1 Answer

0

Yes, the state vector determines which underlying generator the function will use. The random number generating functions in GAUSS will always return the same type of state vector which was passed in. So both r_1 and r_2 in your example will be created using the mrg32k3a.

However, if you do NOT pass in a state vector, then GAUSS will use an internally handled state vector which uses the default generator (Mersenne-Twister). For example:

state_1 = rndCreateState("mrg32k3a", 54443);

//Use the 'mrg32k3a'
{ r_1, state_1 } = rndn(100, 1);

//Use the internally managed state vector
//which defaults to the Mersenne-Twister
r_2 = rndn(100, 1);

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.