If you do something erratically, you do it in an arbitrary or irregular way. Driving erratically is a good way to get pulled over by a traffic cop.
A new bike rider might pedal erratically up and down the street, swerving and stopping suddenly. Or, your anxiety about getting an important grade could make you behave erratically, chewing your nails nervously one minute and laughing loudly the next. Things that are erratic are uneven or unpredictable, and the Latin root is erraticus, "wandering, straying, or roving."