I have an array and I want to randomize this array so that every time I start the app the elements are in a different position, how can I do this? I have found different extensions on the internet, and some work, but when doing it random, they repeat some pieces and they do not work or they do not work because I get this error.
Can not use mutating member on immutable value of type '[String]'
I have tried to solve this error, but what I find I can not understand why the error or how to solve it, I am a beginner in swift, I'm just working with Spritekit, I thought the error was because the array is in a struct, and I changed it to a class but it did not work, I'm using swift 4.1 I hope somebody could guide me on how to solve this problem I thank you from now:)
EDIT I have found the error of repeating elements, that array and properties I have in another class / struct and I need to accommodate the elements in a certain way once I put them in, I add them to the scene with a for and that for, I believe to call the class 25 times so that's why I repeat the elements, I hope I could have explained and hopefully now if you can help me :(
for container in 0...24{
self.addChild(containerSprite[container].block)
}