Xorshift32 Code Conversion?

How to convert this RNG?
https://en.wikipedia.org/wiki/Xorshift

uint32_t xorshift32(void) {
state ^= state << 13;
state ^= state >> 17;
state ^= state << 5;
return state;
}

int randrange(int low,int high) {
return xorshift32()%(high-low+1)+low;
}

XOJO not giving exact results?

Dim m As New MemoryBlock(4)
m.LittleEndian = False
m.Int32Value(0) = 123456789
state = m.UInt32Value(0)

state = state Xor Bitwise.ShiftLeft(state, 13, 32)
state = state Xor Bitwise.ShiftRight(state, 17, 32)
state = state Xor Bitwise.ShiftLeft(state, 5, 32)

MsgBox Str(state)


Private Function randomRange(low As Integer, high As Integer) as Integer
state = randomSeed()
'MsgBox Str(state)
state = state Mod (high-low+1) + low
'MsgBox Str(state)
Return state
End Function

Figure it out MOD is broken, found the workaround.

Private Function myMod(a As UInt32, b As UInt32) as UInt32
Dim tmp As Integer = a/b
return a - (b*tmp)
End Function

Mod is broken?
If that’s the case then create feedback report

xojo gives the same result as here. xojo code:

Dim state As UInt32= 123456789 state= state Xor Bitwise.ShiftLeft(state, 13) state= state Xor Bitwise.ShiftRight(state, 17) state= state Xor Bitwise.ShiftLeft(state, 5)

[quote=478171:@Derk Jochems]Mod is broken?
If that’s the case then create feedback report[/quote]
Mod isn’t broken.
It used Mod instead of integer division i.e. the “” character.