Codice PHP:
if (rand(1,10) <= 5)
   
codiceA;
else
   
codiceB