>>>>> "p46921x" == p46921x  <[EMAIL PROTECTED]> writes:

p46921x> 1. Only characters in the source string are in the random string
p46921x> meaning if Z is not in my source string, it will not be in my random
p46921x> string. If A and B are in the source string, then at least one of them
p46921x> will be in the random string.
p46921x> 2. Each source string will only contain one of the same characters, ie
p46921x> ABcDeFG is a valid source string but  there will be no source strings
p46921x> like ABBDeFG  (as it contains two "B"s).
p46921x> 3. Each random string has one less character than the source string,
p46921x> ie the source string ABcDeFG has 7 characters but the random strings
p46921x> ABDeFG and GABcDe and AcBeDG have 6 characters.

my $input = "ABcDeFG";
use List::Util qw(shuffle); # core in 5.8, CPAN for earlier
my $output = join "", (shuffle split //, $input)[0..length($input)-2];
print $output, "\n";

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to