HyperRandom() returns a random number in the range of a long. Try to see if you can find any flaws with it.
Code: Select all
Procedure.l AbsL(Val.l)
If Val < 0
!neg dword [p.v_Val]
EndIf
ProcedureReturn Val
EndProcedure
Procedure.l HyperRandom()
Static HyperRandomSeed
!rdtsc
!mov cl, ah
!add eax, [so_HyperRandom.v_HyperRandomSeed]
!mov [so_HyperRandom.v_HyperRandomSeed], eax
!ror eax, cl
ProcedureReturn
EndProcedure
OpenWindow(0, 0, 0, 512, 512, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateImage(0, 513, 513)
StartDrawing(ImageOutput(0))
Box(0, 0, 513, 513, #White)
For I = 0 To 512*(384/4)
Plot(AbsL(HyperRandom() >> 22), AbsL(HyperRandom() >> 22), #Red)
Next
StopDrawing()
ImageGadget(0, 0, 0, 512, 512, ImageID(0))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver