Because Windows calculates when the program should be active, the output cannot be random.
But if you don't know how Windows calculates it, you can consider the sequence as random.
It is a matter of point of view.
Anyway, if you need a non-repeatable sequence that you know how and where it came from, maybe such a program can be useful.
I have tested the program with PractRand and RaBiGeTe.
Code: Select all
Function SumOfTimerValues As Double
Dim As Double a
Static As Double b, sum
Do
a = Timer
If (a <> b) Then b = a : Exit Do
Loop
sum += a
Return sum
End Function
Function DoubleToUlongint(x As Double) As Ulongint
Dim As Ulongint Ptr p = Cast(Ulongint Ptr, @x)
Static As Ulongint sum
sum += (*p)
Return sum
End Function
Function Parity64(Byval n As Ulongint) As Ulongint
n = n Xor (n Shr 32)
n = n Xor (n Shr 16)
n = n Xor (n Shr 8)
n = n Xor (n Shr 4)
n = n Xor (n Shr 2)
n = n Xor (n Shr 1)
Return n And 1
End Function
Function NextNumber64 As Ulongint
Dim As Ulongint y
Dim As Ubyte i
For i = 0 To 63
If Parity64(DoubleToUlongint(SumOfTimerValues)) Then y = Bitset(y, i)
Next i
Return y
End Function
''============================
Do
Print Bin(NextNumber64, 64)
Loop Until Getkey = 27 '' Esc