Evolution of cooperation driven by sampling punishment