in reply to Generating a random string of chars, easily.
This works quite nicely as it's self documenting and the return can be assigned directly to a scalar.
#! perl -slw use strict; sub rndStr{local $"=''; "@_[map{rand$#_} 1 .. shift]"; } print rndStr 40, 'a'..'z'; print rndStr 40, 'A'..'Z'; print rndStr 40, 0..9; print rndStr 40, 'a'..'z', 'A'..'Z', 0..9; __END__ C:\test>212859 rxshjxkkgjqhyhukodujhmghpwujqteudxrvxsxo MCRFGFETIDWEDHBWVSDKGJVMOEDEWKIJXRKAAGSQ 3288712881034147833223824725784363650780 EL0A5PsUCzPb8Sh3IyFGrCKElRPPeilXTPQDreKz C:\test>
Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Generating a random string of chars, easily.
by Sihal (Pilgrim) on Nov 14, 2002 at 16:46 UTC | |
|
Re: Re: Generating a random string of chars, easily.
by Sihal (Pilgrim) on Nov 14, 2002 at 16:52 UTC | |
by BrowserUk (Patriarch) on Nov 14, 2002 at 17:13 UTC | |
by Sihal (Pilgrim) on Nov 14, 2002 at 18:25 UTC | |
|
Re: Re: Generating a random string of chars, easily.
by Sihal (Pilgrim) on Nov 14, 2002 at 18:54 UTC | |
by BrowserUk (Patriarch) on Nov 14, 2002 at 19:47 UTC | |
by Sihal (Pilgrim) on Nov 14, 2002 at 21:02 UTC |