tsolrm Posted March 24, 2012 Share Posted March 24, 2012 I want to generate all possible combinations of letters a-z and numbers 0-9 which have 6 characters. For example 000001 000002 ... 00000a ... 000011 ... and etc, obviously there would be millions of them and the text file will be a few gigabytes but the question i want to ask is - how long would this take? A day? two? Is it even worth trying to put a code together? Link to comment Share on other sites More sharing options...
Andreik Posted March 24, 2012 Share Posted March 24, 2012 (edited) it would take some time for an interpreted language like AutoIt because loops are slow but maybe you can try in assembly or c to gain some speed edit: use this code for 5 minutes to gives you an idea $Charset = StringSplit('0123456789abcdefghijklmnopqrstuvwxyz','') For $i1 = 1 To $Charset[0] For $i2 = 1 To $Charset[0] For $i3 = 1 To $Charset[0] For $i4 = 1 To $Charset[0] For $i5 = 1 To $Charset[0] For $i6 = 1 To $Charset[0] ConsoleWrite($Charset[$i1] & $Charset[$i2] & $Charset[$i3] & $Charset[$i4] & $Charset[$i5] & $Charset[$i6] & @CRLF) Next Next Next Next Next Next Edited March 24, 2012 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
czardas Posted March 24, 2012 Share Posted March 24, 2012 Why on Earth do you want all those permutaions? may be worth a read. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
qsek Posted March 24, 2012 Share Posted March 24, 2012 36*36*36*36*36*36 = 2176782336 bytes So the txt file holding the numbers would be a bit over 2 Gbyte. You can do it a lot faster if you only write every 36*36*36*36 loop. so from 000000 to 010000 it would be about 5secs on my 4Ghz PC so it takes about 500 seconds. $Charset = StringSplit('0123456789abcdefghijklmnopqrstuvwxyz','') $hFile = FileOpen("enum.txt",1) For $i1 = 1 To $Charset[0] For $i2 = 1 To $Charset[0] $sStr = "" For $i3 = 1 To $Charset[0] For $i4 = 1 To $Charset[0] For $i5 = 1 To $Charset[0] For $i6 = 1 To $Charset[0] $sStr &= $Charset[$i1] & $Charset[$i2] & $Charset[$i3] & $Charset[$i4] & $Charset[$i5] & $Charset[$i6] & @CRLF Next Next Next Next ;~ ConsoleWrite($Charset[$i1] & $Charset[$i2] & $Charset[$i3-1] & $Charset[$i4-1] & $Charset[$i5-1] & $Charset[$i6-1] & @CRLF ) FileWrite($hFile, $sStr) Next Next FileClose($hFile) Good luck opening the txt file in notepad Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite Link to comment Share on other sites More sharing options...
tsolrm Posted March 24, 2012 Author Share Posted March 24, 2012 (edited) 2Gbyte is actually nothing really. I have no intentions of opening the text file in notepad Wow didn't expect u guys to come up with the code for this. Thanks! Another issue would be - reading this data into a variable. I have a Maths problem which I won't get into since its not important and I'm trying to prove that u can solve it by permutating all possible solutions. So I would need to compare each string against some conditions. Normally I would read the text file into an array and do a For $i=1 to $array [0] but in this case I guess that would not be possible Edited March 24, 2012 by tsolrm Link to comment Share on other sites More sharing options...
qsek Posted March 25, 2012 Share Posted March 25, 2012 (edited) depends on the complexity and scale of the comparison you want to use on every permutation.You could easily put all the content into one string variable, given that you have enough RAM in your machine. But that wont help us much witch further processingSo you could put the strings into a alarmingly big 1dim array.But over time i've come to one conclusion about AutoIt and Arrays:The bigger the array, the slower is any processing.And with this amount of elements im sure you will exceed limitations of autoit and/or your PC very soon.So why not make your comparison while the strings are created? If this is possible.You would have to define your method a bit deeper so we can make the right assumptions.Edit: found information about the exact limits:From helpfile FAQ#15 What are the current technical limits of AutoIt v3?Maximum string length: 2,147,483,647 charactersArrays: A maximum of 64 dimensions and/or a total of 16 million elements Edited March 25, 2012 by qsek Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now