There isn't any randomness involved. Everything is defined to slide in/out at specific intervals. Once you click an alligator (either with or without sunglasses), that alligator is hidden for the rest of the game. The other alligator continues on sliding in/out at the specified duration for each cycle (there's about three cycles for the game...) until you click it as well.
However, the game does have a feel of randomness do the the different speeds of sliding and the multiple instances of an alligator sliding in/out during a cycle. It's very nifty.
How is the randomness produced?