Hello, this is perl.beginners and I am really a beginner. This is also
my first Google group post so if I am in the wrong group, I am sorry.

I need to create a random combination of n-1 characters in a source
string. For example if the string is ABcDeFG (7 characters)
* I want to execute my perl script and get ABDeFG (6 characters)
* I execute my perl script a second time and get GABcDe (6 characters)
* I do it a third time and get AcBeDG (6 characters)
* etc

Also

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

I can see how to generate a random number between 0 and 6 (meaning I
can pick one of the 7 characters in my source string) by using "print
int(rand(6))",  but I don't know where to being on the second and
third and fourth characters to and check that the random number hasn't
already been chosen.


Any help would be welcome. The more cryptic the better as it will
force me to understand what the Perl does ;)

Thank you
Richard

ps: I hope you don't mind but because I don't want spam, I have
created this email address specifically to post to Google groups. If
you are going to reply and I hope you do, please post to the Google
group as my email address will not be monitored.

ps: This isn't for school, it's sort of for fun for a program I am
writing to do crosswords.

ps: When I type perl - version, I see this as my version number
"v5.8.8 built for i486-linux-gnu-thread-multi".

ps: I have "Learning Perl 4th edition from Randal Schwartz". It is a
good book but doesn't describe the type of things I need to do. I have
access to Google but haven't been able to search a good link for the
type of random string code to work from for my problem.


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


Reply via email to