Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Iterating through string combinations

by mortis (Pilgrim)
on Dec 18, 2001 at 03:43 UTC ( [id://132736]=note: print w/replies, xml ) Need Help??


in reply to Iterating through string combinations

If what I think you're doing is correct, your main loop will be attempting to experience 7,958,661,109,946,400,884,391,936 iterations. I say attempting, because I doubt that you (or I, or my children's children) will live to see such a program complete.

What your incrementation scheme is basicly implementing is a base 36 (26 letters + 10 digits) number. You are incrementing it up to 16 digits, so you'll have 36 ^ 16th iterations (try bc(2) for a quick util that supports arbitrarily large numbers).

Perhaps there is a better way to attack the problem you're trying to solve? I won't go any further, as this looks not unlike an attempt at cracking passwords.

  • Comment on Re: Iterating through string combinations

Replies are listed 'Best First'.
Re: Re: Iterating through string combinations
by patgas (Friar) on Dec 18, 2001 at 10:31 UTC

    Don't worry, it's nothing as malevolant as cracking passwords... While talking to a friend, I had a silly idea to create a Net::AIM bot that worked through all the AOL screen names to figure out the percentages of the 4 user types, and maybe how many screen names are actually still available. I did the math using the same base 36 idea as you, so I realized it was pretty much futile doing it like this. But I still wanted to write the code for it, even if the sun would explode before it finished... *shrug* Maybe in a few years when we have super nano quantum processors, I'll pull it off the shelf and run it then... Anyway, it was an interesting idea, sorta.

    "We're experiencing some Godzilla-related turbulence..."

      If you want to work out percentages, what you *really* want to be doing is to randomly pick valid usernames and go from there.

      The code to randomly generate a username is left as an exercise for the reader. (minus 3 points for saying "Use the loop above to generate an array and then pick random elements from that", although I do grant that is how a mathematician would approach the problem.)

      Q: How does a mathematician boil an empty kettle?
      A: S/He fills the kettle, switches it on and waits for it to boil.

      Q: How does a mathematician boil a kettle full of water?
      A: S/He empties the kettle, reducing it to the previous problem.

      Disclaimer: I may have studied mathematics in the past...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://132736]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found