ARTLUNG LAB Share

January 3, 2009

20 Random Alphanumeric Passwords

The passwords:

No record is made of these passwords.



Deprecated: Implicit conversion from float 438049.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 438670.00000000006 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 438880.00000000006 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 439089.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 440339.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 440619.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
o27HrUxpxSHUe8FwgWUW UGHgjuqh9aFCbUcZswsN cFA3zggCxMKkp4VLqceA
Deprecated: Implicit conversion from float 444220.00000000006 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
bkwndHFJPtqfE2m46ZMY yRd8zsHkmCAUga9zwjWz
Deprecated: Implicit conversion from float 447830.00000000006 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 447969.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
yJEwkbZsCpmoQPzjQf3x
Deprecated: Implicit conversion from float 449499.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
TUfLbsEuGoKdQmBYBt9q qU8TPWZL8PfnYedTFQUg o3azFytMFuPoyjkJrDqj
Deprecated: Implicit conversion from float 454079.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
z7CqUwCgLqwWqMaNLzNa rAcwnQ4ayzb7HW33r8kf w8yBkCzcqkWeGsGwGUom dFcutq9XjjTnEYks8txh JuQfdTFLAtsXnBKvVqby uZr4ALxjSxpvDzLjUdvw Y48mEeQ3z6LtqzWC3Fnm 8RcA7bcFoPvCnsy6xDjp
Deprecated: Implicit conversion from float 464270.00000000006 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43

Deprecated: Implicit conversion from float 465039.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
xumf4NaHpctNKK46jVtg 8nVf7RoJBNUZyREG7zGT
Deprecated: Implicit conversion from float 467539.99999999994 to int loses precision in /usr/home/crawberts/public_html/lab.artlung.com/web/password-maker/PasswordGenerator.php on line 43
hLr72nZm3aqKvwMx979N

The code for the class


<?php

/**
 * Class PasswordGenerator
 *
 * @category PHP
 * @package  Classes
 * @author   Joe Crawford <joe@artlung.com>
 * @license  GPL 2.0+ - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * @version  Release: 1.0
 * @link     https://artlung.com/
 * @since    2024-12-03
 */
class PasswordGenerator
{

    public static 
$letters "2346789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnopqrstuvwxyz";
    public static 
$length "20";
    public 
$letters_array;

    
/**
     * PasswordGenerator constructor.
     */
    
function __construct()
    {
        
$this->letters_array = array();

        for (
$a 0$a strlen(self::$letters); $a++) {
            
$this->letters_array[] = self::$letters[$a];
        }
    }


    
/**
     * Make password
     *
     * @return string
     */
    
function make(): string
    
{
        
$password '';
        for (
$i 0$i self::$length$i++) {
            
srand((float)microtime() * 10000000);
            
$password .= $this->letters_array[array_rand($this->letters_array)];
        }
        return 
$password;

    }

    
/**
     * Print one password
     *
     * @return void
     */
    
function printOne()
    {
        print 
$this->make();
    }

    
/**
     * Print many passwords
     *
     * @param $num
     *
     * @return void
     */
    
function printMany($num)
    {
        for (
$i 0$i $num$i++) {
            
$this->printOne();
            print 
"\n";
        }
    }


}

How to invoke the class

$PG = new PasswordGenerator();
$PG->printMany(20);