From: Bill Kelly Date: 2008-06-29T14:42:26+09:00 Subject: Re: Random Generation of Characters From: "Tj Superfly" > > How could you generate a list of all possible combination's of lowercase > letters (a-z) and numbers (0-9). > > Example: ztd6dnck > > Now, I know of ways I can do this, but it's definitely not the most > efficient or fastest way possible, which is why I'm reaching out to this > community. It would be extremely nice if the program would do it in some > type of order (aaaaaaaa, aaaaaaab...etc. - or something along those > lines) because then it would know when it's complete. There can NOT be > ANY repeats, and it must include all combination's. If you didn't need mixed letters and numbers, you could use: (for example) ("aaa".."zzz").to_a For mixed letters and numbers, you could use base 36. Note, if you really want eight characters width, you are talking about a *huge* number of strings here... >> "zzzzzzzz".to_i(36) => 2821109907455 Two point eight trillion.... So... You could do... 0.upto("zzzzzzzz".to_i(36)) {|n| puts n.to_s(36)} ...but it would take a long time to finish. :) > I would want the list to be in an array which I could then export to a > yaml file and save for later use. The number of items in the list is too big for this to be practical. What problem are you trying to solve? Regards, Bill