How do you play against bad players that play any two cards? I have problems with them as putting them on a range of hands is difficult for me to play against them, even harder when they have position on you.
Part of the secret is to not worry to much about their exact range, but more about classifying your own hand correctly and take lines, which are long term profitable in general against loose players. In the course "become a winning poker player in 30 days" Collin Moshman talk about the concept of hand planning.
When you see the flop, the very first thing, you do, is to classify your relative hand strength and determine, how many bets you would like to go in. If for instance you opened AA, and the loose player called you in position, then most of the time the answer will be, that you want 3 bets to go in, unless the board change in a very unfavourable way like putting out a 1-liner to a straight or flush.
So if the loose player with position on you is also passive, and the effective stack is 30-40BB, probably the plan is a very simple bet, bet, shove. So you bet, he call. Turn is a blank, you bet, he call. River is also a blank like an offsuit 4, so you carry through with your plan and shove for 63% pot. He call and show Q4 offsuit, which rivered two pair.
The point here is, that you did not need to know, that his range included Q4 offsuit. All, you needed to know, was, that you could take this line and show down the best hand more than 50% of the time. Which I think, you almost certainly can, if his range is wide enough to include Q4 offsuit.
Or lets say, you were 100BB deep. Then he might have raised you on the river, and again the important is not to know, that he might have that random two pair with Q4 offsuit. The important is to know, that when a passive player call preflop, call on the flop, call on the turn and raise on the river, then he can almost always beat one pair. So you should fold your AA.
The real issue for many players is, that they cant fold in the second scenario, and even in the first scenario it tilts them to lose to a hand, that the opponent should not have played. They feel, that when the opponent is so bad, they deserve to win every time. But as has been said many times, this is the difference between poker and chess.