First time MATLAB is open Shuffle gives the same order

Hi,

We are trying to use Shuffle to randomize our trial order. But when we open MATLAB we are getting the same trial order, as if the randomizer is seeded. But from what I can see, there is no seeding option, and there is no way to turn of this seeding. We can replicate this using

randvec(1:10,1) = 1:10; Shuffle(randvec)

And restarting Matlab each time.

Could you help provide a suggestion on making this truly a random shuffle?
Thanks

That is the design by Matlab.
When you want random seed, you will need to set random seed before you use any of those rand* functions. PTB has

ClockRandSeed
1 Like

You need to choose a random seed if you want to have different random sequences, otherwise the default seed is zero. You want to call the function rng(“shuffle”) once at the top of your script.

keith

1 Like

ClockRandSeed is the recommended choice over rng('shuffle') as it will call rng('shuffle') internally if supported, but fall back to other good solutions if the given Matlab or Octave version does not support the former.