How do I remove the WordPress version from the browser source?

Your code works for me in version 4.7.2 with 2016 theme, but a slightly simpler version is to remove the action entirely rather than filter the output:

remove_action( 'wp_head', 'wp_generator' );

techhipbettruvabetnorabahisbahis forumuedueduedueduedueduseduedueduedus