I need a loop that creates al the possible values
Blitz3D Forums/Blitz3D Beginners Area/I need a loop that creates al the possible values
| ||
| H! For a non game project I need all the unique numbers that are posible ! But I only want the 8 bit style. [pjew :)] first number:01111111 last number :10000000 I know that's a really big file. I did a test but that don't work:
Dim reeks%(11111111)
Dim code%(11111111)
Global i%
i% = 0
fileout = WriteFile("codes.txt")
Repeat
SeedRnd(MilliSecs())
i1% = Rand(0,1)
i2% = Rand(0,1)
i3% = Rand(0,1)
i4% = Rand(0,1)
i5% = Rand(0,1)
i6% = Rand(0,1)
i7% = Rand(0,1)
i8% = Rand(0,1)
If Len(i1%) <> 1 i1% = Rand(0,1)
If Len(i2%) <> 1 i2% = Rand(0,1)
If Len(i3%) <> 1 i3% = Rand(0,1)
If Len(i4%) <> 1 i4% = Rand(0,1)
If Len(i5%) <> 1 i5% = Rand(0,1)
If Len(i6%) <> 1 i6% = Rand(0,1)
If Len(i7%) <> 1 i7% = Rand(0,1)
If Len(i8%) <> 1 i8% = Rand(0,1)
code%(i%)= ""+i1%+""+i2%+""+i3%+""+i4%+""+i5%+""+i6%+""+i7%+""+i8%+""
If Len(code%(i%)) <> 8 Then
Print "false"
Else
For t% = 0 To i%
If reeks%(t%) <> code%(i%) Then
reeks%(i%) = code%(i%)
WriteLine(fileout,reeks%(i%))
Print reeks%(i%)
EndIf
Next
EndIf
i% = i%+1
Until KeyHit(1)
CloseFile(fileout)
WaitKey
I hope someone can help me, Thanks Very Much |
| ||
| I was looking through your code and am a lot baffled as to what you are trying to accomplish. Are you saying that you want to know all the possible combinations of a number Between %01111111 and %10000000. that would be 0 because there is nothing between 127 and 128 Binary. :) Or are you saying all possible numbers between %00000000 and %11111111. If that's the case then there are 256. combinations. Please Explain a little more. |
| ||
| the 256 combinations :) for example : 10000000 11000000 10000001 all of them. |
| ||
| Graphics 800,600,0,0 Dim bin_nums$(255) For n=0 To 255 bin_nums(n)=Bin$(n) Next SetBuffer BackBuffer() Text 0,0,bin_nums(255) Flip End <<Untested>> |
| ||
| cool, i was searching for that Bin$(interger) function |
| ||
| Here's a fairly orderly display, GC!! |