samedi 1 septembre 2018

Shuffling 2D Array

I have a 2D string array.

I just want to shuffle it by rows and columns, but i want to prevent diagonal substitutions.

So for example:

[1,2
 3,4]

I want it to be

[4,3
 1,2] or [3,4
           2,1] or [4,3
                    2,1]

and i want to avoid this shuffling:

[1,3
 2,4]

So here is my array:

array_to_shuffle = new string[len_2d,2];
Shuffle(array_to_shuffle);

and the function i need help :

public void Shuffle(string[,] array)
    {
        Random rand = new Random();


    }

Thank you everyone...




Aucun commentaire:

Enregistrer un commentaire