Hi pls help! I want to simply random my array! but it has errors. take a look: public string[] magictKind = {"jetPack" , "magnet" , "bike" , "big" , "bunny" , "plane" }; function Start() { // I want to random it but it has an error magictKind = magictKind[ Random.Range( 0 , magictKind.Length ) ]; } what is the correct way? Im a javscripter so I dont know how to do it correctly in c# pls help tnx
hmm find the solution. void RandomizeStringArray( string[] arr ) { for (int i = arr.Length - 1; i > 0; i--) { var r = Random.Range(0,i); var tmp = arr; arr = arr[r]; arr[r] = tmp; } }