Ahh the eternal pony drum problem... I've replaced masters, boosters, calipers, shoes, cylinders, bled all the sides repeatedly... all to try to fix this problem (mine is actually, you press once, it stops good, but release and press again and the brake pedal firms up very well)
The problem was the little springs in the brake drum not acting on the autoadjuster. Since not even Hyundai Canada has any left for the pony, i've adapted some random ones I found for other cars at UAC/NAPA.
But, mine happens all the time, not randomly like urs. Try checking the springs, one could be completely broken off and only sometimes when teh cylinder in the drum acts on the shoes in a certain fashion (certain angle really, as no springs to guide it's proper return) it could be causing excessive brake play.
I would take it in to a shop, I don't mess around with brakes.