# Solved: Large Number Sequential List Generator



## AlexSix (Jan 4, 2010)

Hey guys, I don't do much programming, but need to create a huge list of numbers in a certain format. And not sure where to start or know the proper commands.

I need to create a list of sequential numbers in hexidecimal (0-F) and need it formatted a certain way

00000000-00000000-00000000-00000000
to
FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF

The number is 32 to the x16 and I do need the hyphens in the numbers and a "," in front of every number and a "." at the end of every number.

Then put all numbers into a plain text file.

If any one can help, I would greatly appreciate it.

Thanks!


----------



## Squashman (Apr 4, 2003)

So are you saying every two digits is the hex code. So with Zero being the very first sequential number it should output like this.

,30303030-30303030-30303030-3030303030. (This would equal 0-0-0-0)
,30303030-30303030-30303030-3030303031. (This would equal 0-0-0-1)


----------



## AlexSix (Jan 4, 2010)

list need to be in sequential order.

like so:

00000000-00000000-00000000-00000000
00000000-00000000-00000000-00000001
00000000-00000000-00000000-00000002
00000000-00000000-00000000-00000003
00000000-00000000-00000000-00000004
etc...
00000000-00000000-00000000-0000000F
00000000-00000000-00000000-00000010
and so on to...
FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF

just need to create this huge list of numbers in order to a text file.

The end result I'm looking for is:
,00000000-00000000-00000000-00000000.
all numbers in between
,FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF.


----------



## Squashman (Apr 4, 2003)

I guess that really doesn't answer my question.
Is every two bytes a hex code?


----------



## AlexSix (Jan 4, 2010)

No, it's just plain number 32 characters long and I'm using base 16 hexidecimal 0 - F, but I need the hyphens in there as above.


----------



## cwwozniak (Nov 29, 2005)

Forget about it.

Your text file would need to be approximately 1.225 x 10^40 (1225 followed by 37 zeroes) bytes in size. I don't think that even all of the servers used by Google would have enough hard drive space to store such a file. Even if you could generate and store a 1000 million numbers per second, it would take about 10790000000000000000000 years to generate all of the numbers.


----------



## AlexSix (Jan 4, 2010)

no, it's 32 to the 16th power.
1208925819614629174706176 numbers.


----------



## cwwozniak (Nov 29, 2005)

No, I believe that 00000000-00000000-00000000-00000000 through
FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF is 16 raised to the 32 power.


----------



## AlexSix (Jan 4, 2010)

Yes, I stand corrected. Is it possible to make a list using the same parameters, but create 10,000 random numbers at a time?


----------



## TheOutcaste (Aug 8, 2007)

Looks like others have mentioned this since I opened this tab, but here's the numbers and code I came up with.

It's 4 groups of 8 hex characters (4*32 bits) so its a 128 bit number, or 2^128 (or 4^64, 8^32, 16^16, or 32^8).

Do you have any idea what the size of the resulting file would be?
You need 37 bytes per line, plus 2 more for the CR/LF
The first section, from
00000000-00000000-00000000-00000000
to
00000000-00000000-00000000-FFFFFFFFF
is 4,294,967,296 lines, requiring 156 GiB of disk space.
So you need a 156*156*156*156=592,240,896 GiB drive. Or 39 * 2^128 or in scientific notation, 1.327 e+40
Since a 1 TB drive is actually only 931 GiB, that's roughly 636,135 drives, each with a 1 TB capacity.
These need to be joined into one volume, or you'll need additional code to mount and unmount the drives as needed. Can't use any of the zip programs to split it, as they need the file to be created first.
At an average of 10-15 watts per drive, I'd hate to see that power bill.

Not to mention the time it would take, as that's already been mentioned.

Anyways, here's the code to create the numbers. I'll leave figuring out how to switch drives to someone else.

```
@Echo Off
Set _OutFile=C:\BigFile\Numbers.txt
Set _Hex=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
For %%a In (%_hex%) Do (
For %%b In (%_hex%) Do (
For %%c In (%_hex%) Do (
For %%d In (%_hex%) Do (
For %%e In (%_hex%) Do (
For %%f In (%_hex%) Do (
For %%g In (%_hex%) Do (
For %%h In (%_hex%) Do (

For %%i In (%_hex%) Do (
For %%j In (%_hex%) Do (
For %%k In (%_hex%) Do (
For %%l In (%_hex%) Do (
For %%m In (%_hex%) Do (
For %%n In (%_hex%) Do (
For %%o In (%_hex%) Do (
For %%p In (%_hex%) Do (

For %%q In (%_hex%) Do (
For %%r In (%_hex%) Do (
For %%s In (%_hex%) Do (
For %%t In (%_hex%) Do (
For %%u In (%_hex%) Do (
For %%v In (%_hex%) Do (
For %%w In (%_hex%) Do (
For %%x In (%_hex%) Do (

For %%y In (%_hex%) Do (
For %%z In (%_hex%) Do (
For %%A In (%_hex%) Do (
For %%B In (%_hex%) Do (
For %%C In (%_hex%) Do (
For %%D In (%_hex%) Do (
For %%E In (%_hex%) Do (
For %%F In (%_hex%) Do (

>>"%_OutFile%" Echo.,%%a%%b%%c%%d%%e%%f%%g%%h-%%i%%j%%k%%l%%m%%n%%o%%p-%%q%%r%%s%%t%%u%%v%%w%%x-%%y%%z%%A%%B%%C%%D%%E%%F.
))))))))))))))))))))))))))))))))
```
To generate 10,000 random numbers, this should work:

```
@Echo Off
SetLocal EnableDelayedExpansion
Set _Outfile=C:\Test\hexnum.txt
Set _Hex=0123456789ABCDEF
For /L %%A In (1,1,10000) Do (
For /L %%I In (0,1,32) Do (
Set /A _Rand=!Random!%%16
Call Set _D%%I=%%_Hex:~!_Rand!,1%%
)
>>"%_OutFile%" Echo.,!_D0!!_D1!!_D2!!_D3!!_D4!!_D5!!_D6!!_D7!!_D8!-!_D9!!_D10!!_D11!!_D12!!_D13!!_D14!!_D15!!_D16!-!_D17!!_D18!!_D19!!_D20!!_D21!!_D22!!_D23!!_D24!-!_D25!!_D26!!_D27!!_D28!!_D29!!_D30!!_D31!!_D32!.
)
```
*EDIT*: Guess I should add these are both batch files. Copy the code and paste into Notepad.
Edit the *Set _OutFile=* line to point to the location and name of the output file.
Save it with a *.bat* or *.cmd* extension. (Change the *Save as Type:* box to *All Files*).


----------



## cwwozniak (Nov 29, 2005)

TheOutcaste said:


> To generate 10,000 random numbers, this should work:


Hope that *AlexSix* doesn't need a list of 10,000 unique random numbers. You would need to check every newly generated number to make sure it wasn't all ready in the list.


----------



## TheOutcaste (Aug 8, 2007)

Good point. Though unlikely, there could be duplicates.
So just in case, this will check for duplicates, and discard any numbers that already exist and generate a new one.
Taks a bit longer.
Without checking takes about 5 min 17 seconds
With checking takes about 11 min 04 seconds
On a Core 2 Duo, 2GHz, running Win 7 Ultimate x64

```
@Echo Off
SetLocal EnableDelayedExpansion
Set _OutFile=C:\Temp Dir\hexnumber.txt
Set _Hex=0123456789ABCDEF
Set _Count=0
Set _Number=10000
If Exist "%_OutFile%" Del "%_OutFile%"
For /L %%I In (0,1,32) Do (
Set /A _Rand=!Random!%%16
Call Set _D%%I=%%_Hex:~!_Rand!,1%%
)
:_Loop1
>>"%_OutFile%" Echo.,!_D0!!_D1!!_D2!!_D3!!_D4!!_D5!!_D6!!_D7!!_D8!-!_D9!!_D10!!_D11!!_D12!!_D13!!_D14!!_D15!!_D16!-!_D17!!_D18!!_D19!!_D20!!_D21!!_D22!!_D23!!_D24!-!_D25!!_D26!!_D27!!_D28!!_D29!!_D30!!_D31!!_D32!.
Set /A _Count+=1
If %_Count%==%_Number% Goto :EOF
:_Loop2
For /L %%I In (0,1,32) Do (
Set /A _Rand=!Random!%%16
Call Set _D%%I=%%_Hex:~!_Rand!,1%%
)
Find ",!_D0!!_D1!!_D2!!_D3!!_D4!!_D5!!_D6!!_D7!!_D8!-!_D9!!_D10!!_D11!!_D12!!_D13!!_D14!!_D15!!_D16!-!_D17!!_D18!!_D19!!_D20!!_D21!!_D22!!_D23!!_D24!-!_D25!!_D26!!_D27!!_D28!!_D29!!_D30!!_D31!!_D32!." "%_OutFile%">Nul
If !ErrorLevel! == 0 (Goto _Loop2) Else Goto _Loop1
```


----------



## AlexSix (Jan 4, 2010)

Thanks cw! The random code works great! And after explaining the astronomical resources that would be needed to the company, they were fine. Thanks for all your support and expert knowledge.

Thanks again,
Alex


----------



## Squashman (Apr 4, 2003)

AlexSix said:


> Thanks cw! The random code works great! And after explaining the astronomical resources that would be needed to the company, they were fine. Thanks for all your support and expert knowledge.
> 
> Thanks again,
> Alex


Yeah Good Job. TheOutcaste!


----------



## cwwozniak (Nov 29, 2005)

AlexSix said:


> Thanks cw!




You should be thanking *TheOutcaste*; they came up with the code.


----------



## AlexSix (Jan 4, 2010)

Yes, sorry about that! Thank you Outcaste!!!!


----------



## TheOutcaste (Aug 8, 2007)

:up:
You're Welcome!


----------

