good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Random word generatorby McDarren (Abbot) |
on Feb 27, 2008 at 14:29 UTC ( [id://670642]=note: print w/replies, xml ) | Need Help?? |
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):
Hope this helps,
In Section
Seekers of Perl Wisdom
|
|