# hey guys i have a problem with my array : IndexOutOfRangeException: Array index is out of range.

i Defined int tuss_array=new int[24]
how can i fix it?

here is my code:

``````//provide random number
void RandomTuss(){

tuss1 = Random.Range (tussmin1, tussmax1);
tuss2 = Random.Range (tussmin2, tussmax2);

tuss_result= "TuSS1:"+tuss1.ToString () + "TuSS2:"+tuss2.ToString ();

if (tuss1 == tuss2)
{
Debug.Log("Great!"+"num of toss1:"+"   "+tuss1+"num of toss2:"+"   "+tuss2);
}

Debug.Log (" toss1 is:"+"   " +  tuss1+ " toss2 is:"+"   " + tuss2 );

//Checking tuss1 and tuss2 then make a decision x coin should move

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

if(tuss_array*>0)*
``````
• `````` 	{*
``````
• `````` 		int tuss_pair=i-tuss1+tuss2;*
``````
• `````` 		int white_Coin_Tuss1=i-tuss1;*
``````
• `````` 		int white_Coin_Tuss2=i-tuss2;*
``````
• `````` 		int white_Coin_TussPair=i-tuss_pair;*
``````
• `````` 		if(tuss_array[white_Coin_Tuss1] > -2);*
``````
• `````` 		{*
``````
• `````` 				Debug.Log (" the white Coins should move to these points(tuss1):  " + white_Coin_Tuss1.ToString());*
``````
• `````` 		}*
``````
• `````` 		if(tuss_array[white_Coin_Tuss2] > -2);*
``````
• `````` 		{*
``````
• `````` 			Debug.Log (" the white Coins  should move to these points(tuss2):  " + white_Coin_Tuss2.ToString());*
``````
• `````` 		}*
``````
• `````` 		if(tuss_array[tuss_pair] > -2 );*
``````
• `````` 		{*
``````
• `````` 			Debug.Log (" the white Coins can should to these points(Pair):  " + tuss_pair.ToString());*
``````
• `````` 		}*
``````
• `````` 		}*
``````
• `````` 	}*
``````
• }*

many thank’s