I have code for an AI that I am creating for pong. I am trying to get it so that it will have to wait based on a small probability. If anyone has code or an idea on how to program this please reply
private int waitTimer;
if (Greenfoot.getRandomNumber(1000) == 0) waitTimer = 20;
if (waitTimer > 0 && --waitTimer != 0) return;