If someone does something willy-nilly, they do it in a careless and disorganized way, without planning it in advance. Clerks bundled papers into files willy-nilly
If something happens to you willy-nilly, it happens whether you like it or not. The government were dragged willy-nilly into the confrontation