random_password Procedure


This procedure returns a random word for use as a password. Consonants and vowels are alternated to give a (hopefully) pronouncable, and hence memorable, result.

The single (optional) argument sets the approximate length of the word. Use of dipthongs (two-letter combinations) may make the word exceed this length by 1. If the argument is omitted, a default value (6) is assumed.


Once the procedure has been added to your program using the require command, passwords can be generated as follows:

$my_new_password  = &random_password();
$my_long_password = &random_password(10);


If the above looks useful to you, download password.zip which contains the random_password procedure and an example of its use.

This code is made available for use in both private and commercial applications under a Creative Commons Licence.

Whilst every effort has been made to ensure these routines operate accurately and properly, no liability will be accepted for any problems they may cause on your system.

One Response to “random_password Procedure”

  1. John A. Johnson Says:

    I have been using this great subroutine for years to generate identifiers for persons who complete my online personality questionnaire, but leave the nickname box blank. It has worked so well for me that I am recommending it in a chapter I am writing for a book on behavioral research on the Internet.

Leave a Comment