How to get a random element from an array thats different from previous one?

You can achieve this by storing the previous element and using a simple loop to keep picking a new random element until it’s different.