What the procedure does is flip the sign of the value on a pseudo random basis.
So it flips, or it doesn't

Code: Select all
Procedure.i PRSF(value.i); Pseudo random sign flip
Static RN.l = $72486161
EnableASM
mov edx, RN
!lea eax, [edx + edx]
!sar edx, 31
!and edx, 0xc0000401
!xor edx, eax
mov RN, edx
!sar edx, 31
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
!movsx rdx, dx
!mov rax, [p.v_value]
!xor rax, rdx
!sub rax, rdx
CompilerElse
!mov eax, [p.v_value]
!xor eax, edx
!sub eax, edx
CompilerEndIf
DisableASM
ProcedureReturn
EndProcedure
Code: Select all
L.l = 123
For i = 1 To 400
L = PRSF(L)
Debug L
Next