random animations

how can i have animations randomly play? for example i have 2 idle animations, one main and one that i would like to play once through at random intervals while the character is not moving. how would i go about getting this to happen? so far i can only get the main idle animation to play.

perhaps your idle animation could be controlled by a coroutine, something like this:

function Idle()
{
    while (idling) {
        if (Random.Range(0,5) > 0) {
            animation.Play(idleClipNormal);
            yield WaitForSeconds (idleClipNormal.length);
        } else {
            animation.Play(idleClipOccasional);
            yield WaitForSeconds (idleClipOccasional.length);
        }
    }
}

This is what I did:

var SceletorObject : GameObject = null;
var curAnim : String = null;
var doAnimation : boolean = false;
private var AnimObj : Animation = null;

function Start(){
    AnimObj=SceletorObject.GetComponent(Animation);
}

function OnTriggerEnter() {
    AnimObj.PlayQueued("raise");
    doAnimation=true;
}
function OnTriggerExit() {
    AnimObj.PlayQueued("hit");
    AnimObj.PlayQueued("die");
    doAnimation=false;
}
function OnTriggerStay(){
    if (!AnimObj.isPlaying && doAnimation)
        doNextAnim();
}
function doNextAnim(){
    var anims=new Array("idle1","idle1","idle1","idle1","idle2","strike"); 
    var length=anims.length-1;
    var index=Mathf.Round(length*UnityEngine.Random.value);
    curAnim=anims[index];
    AnimObj.PlayQueued(curAnim);
}

HTH