Not tested but...

`GLOBAL BSDState#`

GLOBAL MSState%

FUNCTION randBSD#:

BSDState = MOD( (1103515245 * BSDState + 12345), POW (2, 31) )

RETURN BSDState

ENDFUNCTION

FUNCTION randMS%:

MSState% = MOD ( (214013 * MSState + 2531011), POW (2, 31) ) / POW(2, 16)

RETURN MSState%

ENDFUNCTION

BTW POW(x,y) can be replaced by the POW(x,y) result. eg. POW (2, 16) could be replaced with 65536, maybe a compiler optimisation does this anyway?