You’ll need to generate a random number when A is pressed.
EDIT: For example:
#include <stdlib.h>
if(PressedA){
int random=(rand() % 100); // random is in [0,99]
if(random < 15){
command();
}
}
3
solved How can I process a command in determined probability in C? [closed]