# How do I set a seed for the 'Shuffle' function?

**URL:** <https://psychtoolbox.discourse.group/t/how-do-i-set-a-seed-for-the-shuffle-function/3657>\
**Category:** Programming Help\
**Tags:** experiment-design\
**Created:** [February 5, 2021, 8:29pm UTC](https://psychtoolbox.discourse.group/t/how-do-i-set-a-seed-for-the-shuffle-function/3657 "2021-02-05T20:29:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cai](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@Cai](https://psychtoolbox.discourse.group/u/Cai)\
**Post date:** [February 5, 2021, 8:29pm UTC](https://psychtoolbox.discourse.group/t/how-do-i-set-a-seed-for-the-shuffle-function/3657/1 "2021-02-05T20:29:45Z")

</div>

Hi, I am using MATLAB R2020a on a MacOS. I am attempting to shuffle a cell array but was wondering if there is any way of setting a seed such that the shuffling process is constant across several arrays. That is, the shuffling causes the same rearrangement across all the cell arrays I apply it to. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![xiangrui](https://avatars.discourse-cdn.com/v4/letter/x/ec9cab/32.png) [@xiangrui](https://psychtoolbox.discourse.group/u/xiangrui)\
**Post date:** [February 6, 2021, 8:59pm UTC](https://psychtoolbox.discourse.group/t/how-do-i-set-a-seed-for-the-shuffle-function/3657/2 "2021-02-06T20:59:58Z")

</div>

Have you tried `ClockRandSeed` with your seed?
