Doesn't God already know who and when someone is going to masturbate, even before they are born?
Of course He does. He knew you were going to put up your post, and that I would respond.
That, however, only means that He knows. Our free will determines whether we do something, or not.