masih namdar
masih namdar

Reputation: 25

turn string array into char array randomize

I need to shuffle a char array and have a string array that contains words "play" and "game" and have some buttons in my game like this: image1

and this is my code:

for (int i = 0; i < Answers.Length; i++) {
                BtnsCharacter = Answers [i].ToCharArray ();
            } 

but I need is to make a mess in my buttons arraignment wile converting to char in random in every level. like the image bellow for example:

image2

How could I do that

Upvotes: 1

Views: 97

Answers (2)

Nova Jacob
Nova Jacob

Reputation: 26

The answer not from Symon. From Me.

Anyway you have to reference the LINQ Namespace

Upvotes: 0

Nova Jacob
Nova Jacob

Reputation: 26

for (int i = 0; i < Answers.Length; i++) {

 char[] BtnsCharacter = Answers [i].ToCharArray ();

 char[] shuffled = BtnsCharacter.OrderBy(n => Guid.NewGuid()).ToArray();
} 

Upvotes: 1

Related Questions