Codice PHP:
<?php  
function makeKey($len){
      
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'// characters to use in the password
      
mt_srand((double)microtime()*1000000^getmypid());
     while(
strlen($password)<$len){
        
$password.=substr($chars,(mt_rand()%strlen($chars)),1);
      }
      return 
$password;
  }

echo 
makeKey(10);
?>