Something done in a careless, haphazard way is done in a hit-or-miss fashion. The person acting doesn’t seem to care whether the action is successful (a “hit”) or unsuccessful (a “miss”).
The variation “hit and miss” is very popular, but makes less sense. This form of the phrase has traditionally been used to describe certain mechanical devices; but that meaning is rare and antiquated. In almost all contexts, the better form is “hit or miss.”