random idle animation in C#

Hi I am trying to play diffrent idle animations randomly but I kinda cant make it to work in C#.The code compiles but only first animation playes. is there an easy way to change randomly idle animation? in c#

[RequireComponent(typeof(NavMeshAgent))]
public class AutoAnimateNPC : MonoBehaviour {

    Vector3 lastPos;
    public AnimationClip walkAnim;

    public AnimationClip idleAnim;
   public AnimationClip idleAnimm;
    public AnimationClip idleAnimmm;
int aaa=1;
    bool  anim1=true;
    bool  anim2=false;
    bool  anim3=false;



    public bool overrideAnimationSpeeds = false;
    public float idleAnimSpeedModifier = 1.0f;
    public float walkAnimSpeedModifier = 1.0f;



   
    // Use this for initialization
    void Start () {
        lastPos = transform.position;
        if (overrideAnimationSpeeds)
        {
            animation[walkAnim.name].normalizedSpeed = walkAnimSpeedModifier;
            animation[idleAnim.name].normalizedSpeed = idleAnimSpeedModifier;
        }
    }
   
    // Update is called once per frame
    void Update () {
        
        if (GetComponent<NavMeshAgent>().remainingDistance < 0.5f)
        {  
//  here  i tried to alternate  animations  one  by  one  but  i  guess  all of  the "if  statmens" are done in one  frame
// I tried  also with  if(b){changeanimation();)
 if(anim1==true){animation.CrossFade(idleAnim.name, 0.2f);anim1=false; anim2=true;}
 if(anim1==false && anim2==true){animation.CrossFade(idleAnimm.name, 0.2f);anim2=false;anim3=true;}
 if(anim2==false && anim3==true){animation.CrossFade(idleAnimmm.name, 0.2f);anim3=false;anim1=true;}

    }
        else if (lastPos != transform.position)
        {
            animation.CrossFade(walkAnim.name,0.4f);
        }
   void change animation(){

}     


    }


}

and here i tried diffrent solution but wont compile

public class AutoAnimateNPC : MonoBehaviour {

 
using UnityEngine;
using System.Collections;

[RequireComponent(typeof(NavMeshAgent))]
public class AutoAnimateNPC : MonoBehaviour {

    Vector3 lastPos;
    public AnimationClip walkAnim;
    public AnimationClip idleAnim;
    public AnimationClip[] idle =new AnimationClip[2];
    public bool overrideAnimationSpeeds = false;
    public float idleAnimSpeedModifier = 1.0f;
    public float walkAnimSpeedModifier = 1.0f;
    int x;
    // Use this for initialization
    void Start () {
        x = 1;
        lastPos = transform.position;
        if (overrideAnimationSpeeds)
        {
            animation[walkAnim.name].normalizedSpeed = walkAnimSpeedModifier;
            animation[idleAnim.name].normalizedSpeed = idleAnimSpeedModifier;
        }
    }
   
    // Update is called once per frame
    void Update () {


        if (GetComponent<NavMeshAgent> ().remainingDistance < 0.5f) {
                        animation.CrossFade (idle [x], 0.2f);

        if(!animation.IsPlaying(idle[x])){rrr();}
        }
        else if (lastPos != transform.position)
        {
            animation.Play(walkAnim.name);
        }
       
    }

    void rrr(){
        x = Random.Range (0, 2);

    }
}