Advertisement
Blazephlozard

Untitled

Jun 22nd, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. function advanceRNG()
  2.     local temp = RNG2
  3.     temp = bit.rol(temp,2)
  4.     if (bit.check(temp,8)) then temp = bit.set(temp,0) end
  5.     temp = bit.clear(temp,8)
  6.     if (bit.check(temp,9)) then temp = bit.set(temp,1) end
  7.     temp = bit.clear(temp,9)
  8.     temp = bit.bxor(temp,RNG1)
  9.     local carry = bit.check(temp,0)
  10.    
  11.     RNG2 = bit.bxor(RNG2,RNG1)
  12.    
  13.     temp = RNG3
  14.     temp = bit.bxor(temp,RNG1)
  15.     RNG1 = temp
  16.    
  17.     RNG1 = bit.rol(RNG1,1)
  18.     if (carry) then RNG1 = bit.set(RNG1,0) end
  19.     carry = bit.check(RNG1,8)
  20.     RNG1 = bit.clear(RNG1,8)
  21.    
  22.     RNG2 = bit.rol(RNG2,1)
  23.     if (carry) then RNG2 = bit.set(RNG2,0) end
  24.     RNG2 = bit.clear(RNG2,8)
  25.    
  26.     RNG3 = RNG3 + 1
  27.     if (RNG3 == 256) then RNG3 = 0 end
  28.    
  29.     --print(tostring(RNG1))
  30.     --print(tostring(RNG2))
  31.     --print(tostring(RNG3))
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement