The problem is that you're selecting a number at random throughout the range, and you're never adjusting the range. For example, if we were playing the game using 1-100 as the range and you guessed 65 and I said "low", then you'd want to guess a number between 66 and 100. If you then guessed 75 and I said "high", you'd want to guess a number between 66 and 74.
So you need to update the upper or lower limit based on the feedback from the user.
When your only tool is a hammer, all problems look like your thumb.