MATLAB: Generation of random numbers in batches

prngrandom number

Hello,
Imagine the following code in Matlab
rng(1)
a = rand(1,100)
rng(1)
a2 = rand(1,200);
These are two random generators initialized with the same seed. The elements in a are equal to the 100 first elements in a2.
Now, I want to create a random sequence a3 that satisfies a2 = [a, a3].
How should I choose the seed of a3 to satisfy a2? is this even possible?
Best

Best Answer

Found the answer.
Just need to store the state of the generator with s = rng and initialize with rng(s) the next generation
Thanks for your help