The RandomArray plugin may solve the issue, but depending on your implementation, it may not be necessary....
I've accomplished a solution without RandomArray and I think its straightforward and clean. Rather than fill the temp array used in the randomization process, you simply create a new one and fill it. After the randomization process, it's virtually nothing (0 length), so you destroy it. But, remember, this is just a working copy, so the original one is still there to create from.
Another solution may be, to work with an empty array instead of presetting the arrays size. Then, instead of initializing values at different positions, you'd simply push the values into it. If this solution works, you don't ever have to recreate the initial temp copy of the array, but simply re-push initial values into it for the randomization process.
Initially, I did see the array was still there, but of 0 length, but I failed to make the connect to the push method, because my brain was stuck on setting the values by index. So, think push, instead of set.