Doing the random security checks at random times is intentional. They will always knock and announce themselves. However, you can always stop by the front desk and see if they can do the checks during certain time as they can make a note for housekeeping to only service the room at certain times.