look at the following code (VB.NET)
Code:
Dim VarKey1 As Byte
Dim VarKey2 As Byte
Dim VarKey3 As Byte
'Generate new random keys
Randomize()
VarKey1 = CByte(255 * Rnd() + 1)
VarKey2 = CByte(255 * Rnd() + 1)
VarKey3 = CByte(255 * Rnd() + 1)
There is one helava big bug in that code .... and it has the probability of 1:85 in happening ....
In development and testing we executed the complete function about 1000 times already...
Today we were doing a quick speed test, just to see what sort of execution times the code has.. We recursivly called the function 1000 times,and on the 50th execution we hit a problem... "Overflow Error" ....
Look at the code again ... do you see it ???? ....
255 + 1 = 256 = More than a byte,the right code is: 254 * Rnd() + 1 ...
funny thing is this error did not occur on any of the 1000 previous executions, but as soon as we pushed it a little the crack opened up ...
Some bug's need you to push the code HARD to find them ...
Gremmy...