Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function advanceRNG()
- local temp = RNG2
- temp = bit.rol(temp,2)
- if (bit.check(temp,8)) then temp = bit.set(temp,0) end
- temp = bit.clear(temp,8)
- if (bit.check(temp,9)) then temp = bit.set(temp,1) end
- temp = bit.clear(temp,9)
- temp = bit.bxor(temp,RNG1)
- local carry = bit.check(temp,0)
- RNG2 = bit.bxor(RNG2,RNG1)
- temp = RNG3
- temp = bit.bxor(temp,RNG1)
- RNG1 = temp
- RNG1 = bit.rol(RNG1,1)
- if (carry) then RNG1 = bit.set(RNG1,0) end
- carry = bit.check(RNG1,8)
- RNG1 = bit.clear(RNG1,8)
- RNG2 = bit.rol(RNG2,1)
- if (carry) then RNG2 = bit.set(RNG2,0) end
- RNG2 = bit.clear(RNG2,8)
- RNG3 = RNG3 + 1
- if (RNG3 == 256) then RNG3 = 0 end
- --print(tostring(RNG1))
- --print(tostring(RNG2))
- --print(tostring(RNG3))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement