I'm not familiar with solaris, but as it's a *nix system I'd imagine you'll find a wordlist in somewhere like /usr/dict/words.
Using this as a base, it's fairly trivial to generate random words. You can restrict the length with the built in length function.
Alternatively, there is always CPAN - Data::Random::WordList, for example. You could use that to generate the words, and again use length to throw away the ones that are not the right length.
Update: And for no other reason than I felt like it ;), here is a short snippet of code that demonstrates how one might do this (in this case, using shuffle() from List::Util):
#!/usr/bin/perl -l
use strict;
use warnings;
use List::Util qw/shuffle/;
my $wordlist = '/usr/share/dict/words';
my $length = 10;
my $numwords = 10;
my @words;
open WORDS, '<', $wordlist or die "Cannot open $wordlist:$!";
while (my $word = <WORDS>) {
chomp($word);
push @words, $word if (length($word) == $length);
}
close WORDS;
my @shuffled_words = shuffle(@words);
print for @shuffled_words[0 .. 9];
Hope this helps,
Darren :) |