You can drop packets using iptables on a Linux host with some level of randomness.
iptables -A INPUT -m statistic --mode random --probability 0.8 -s example.com -p icmp -j DROP
I also did not know that Linux has a traffic control tool for packet shaping ‘tc’:
tc qdisc change dev eth0 root netem loss 5%
This post explains it very well https://www.badunetworks.com/traffic-shaping-with-tc/
The reddit thread suggests that these may not work so well so your mileage may vary.
Another tool is ‘netem’:
NetEm is an enhancement of the Linux traffic control facilities that allow to add delay, packet loss, duplication and more other characteristics to packets outgoing from a selected network interface. NetEm is built using the existing Quality Of Service (QOS) and Differentiated Services (diffserv) facilities in the Linux kernel.
Source: Reddit Thread