Pistol shrimp generate cavitation bubbles. Cavitation impacts due to bubble collapses are harmful phenomena, as they cause severe damage to hydraulic machinery such as pumps and valves. However, cavitation impacts can be utilized for mechanical surface treatment to improve the fatigue strength of metallic materials, which is called “cavitation peening”. Through conventional cavitation peening, cavitation is generated by a submerged water jet, i.e., a cavitating jet or a pulsed laser. The fatigue strength of magnesium alloy when treated by the pulsed laser is larger than that of the jet. In order to drastically increase the processing efficiency of cavitation peening, the mechanism of pistol shrimp (specifically when used to create a cavitation bubble), i.e., Alpheus randalli, was quantitatively investigated. It was found that a pulsed water jet generates a cavitation bubble when a shrimp snaps its claws. Furthermore, two types of cavitation generators were developed, namely, one that uses a pulsed laser and one that uses a piezo actuator, and this was achieved by mimicking a pistol shrimp. The generation of cavitation bubbles was demonstrated by using both types of cavitation generators: the pulsed laser and the piezo actuator.