#! D:\perl\bin\perl.exe ############################################################################### ############################################################################### # # To generate a square of random letters # # by Andrew Hardwick # Released under GPL. # ############################################################################### ############################################################################### # Version 1, 2005/1/17 ############################################################################### ############################################################################### # How To Use: # Run it with the width (= height) of the grid as its parameter. ############################################################################### ############################################################################### # Include libraries use strict; # Disenable automatic variables ############################################################################### # Settings ############################################################################### my $Characters= # Typical frequency distribution for English text 'A' x 73 . 'B' x 9 . 'C' x 30 . 'D' x 44 . 'E' x 130 . 'F' x 28 . 'G' x 16 . 'H' x 35 . 'I' x 74 . 'J' x 2 . 'K' x 3 . 'L' x 35 . 'M' x 25 . 'N' x 78 . 'O' x 74 . 'P' x 27 . 'Q' x 3 . 'R' x 77 . 'S' x 63 . 'T' x 93 . 'U' x 27 . 'V' x 13 . 'W' x 16 . 'X' x 05 . 'Y' x 19 . 'Z' x 10 ; ############################################################################### # Main rountine ############################################################################### { # Get size unless(@ARGV) { die("You neglected to specify, as a parameter, the size required.\n");} my $Size=shift; for(my $c=0;$c<$Size;$c++) { for(my $d=0;$d<$Size;$d++) { print substr($Characters,rand(length($Characters)),1);} print "\n";}} ###############################################################################