Even If I ++ you for your contribution,
I'd like however to suggest you (and others) to re-use existing monastery resources,
and PROMOTE their use...
using Super Search :
with 'shuffle' or 'fisher yates' as keywords would give several posts,
with this Fisher-Yates algorithm.
You might even find something in the FAQ (How do I shuffle an array randomly?)
Hope this won't prevent you to go on contributing ;-)