Regularity and randomness in the formation of beach cusps