src/bbn/str.php
public static function genpwd(int $int_max = 12, int $int_min = 6): string
  {
    mt_srand();
    $len = ($int_min > 0) && ($int_min < $int_max) ? random_int($int_min, $int_max) : $int_max;
    $mdp = '';
    for( $i = 0; $i < $len; $i++ ){
      // First character is a letter
      $type = $i === 0 ? random_int(2, 3) : random_int(1, 3);
      switch ( $type ){
        case 1:
          $mdp .= random_int(0,9);
          break;
        case 2:
          $mdp .= \chr(random_int(65,90));
          break;
        case 3:
          $mdp .= \chr(random_int(97,122));
          break;
      }
    }
    return $mdp;
  }
public static function genpwd(int $int_max = 12, int $int_min = 6): string
  {
    mt_srand();
    $len = ($int_min > 0) && ($int_min < $int_max) ? random_int($int_min, $int_max) : $int_max;
    $mdp = '';
    for( $i = 0; $i < $len; $i++ ){
      // First character is a letter
      $type = $i === 0 ? random_int(2, 3) : random_int(1, 3);
      switch ( $type ){
        case 1:
          $mdp .= random_int(0,9);
          break;
        case 2:
          $mdp .= \chr(random_int(65,90));
          break;
        case 3:
          $mdp .= \chr(random_int(97,122));
          break;
      }
    }
    return $mdp;
  }
public static function genpwd ( int $ int_max = 12 , int $ int_min = 6 ) : string { mt_srand ( ) ; $ len = ( $ int_min > 0 ) && ( $ int_min < $ int_max ) ? random_int ( $ int_min , $ int_max ) : $ int_max ; $ mdp = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { // First character is a letter $ type = $ i === 0 ? random_int ( 2 , 3 ) : random_int ( 1 , 3 ) ; switch ( $ type ) { case 1 : $ mdp .= random_int ( 0 , 9 ) ; break ; case 2 : $ mdp .= \ chr ( random_int ( 65 , 90 ) ) ; break ; case 3 : $ mdp .= \ chr ( random_int ( 97 , 122 ) ) ; break ; } } return $ mdp ; }
Returns a random password.

```php
\bbn\x::dump(\bbn\str::genpwd());
// (string) "khc9P871w"
\bbn\x::dump(\bbn\str::genpwd(6, 4));
// (string) "dDEtxY"
```

@param int $int_max Maximum password characters, default: "12".
@param int $int_min Minimum password characters, default: "6".
@return string
Returns a random password .