Change animation randomly using script (around 4 animations)

Hi, I wonder how this process will go
How easy it is to create an array of around 5 idles animations and change them randomly.
Like when one finishes another random one starts and this process happnes all the time.
I know that there is an animator for that but I am looking to do it only using script.
Thanks

Idk how in script but the mecanim way is to use sub-state machines.
Might lead to what you want if you look into sub-states in the documentation.

This is a great talk from a couple years ago. David Geoffrey opens up with a demo of randomizing a melee animation. The principle is the same for randomizing an idle animation using StateMachineBehaviours

Cheers,
TrickyHandz