Skip to content

Instantly share code, notes, and snippets.

@TACIXAT
Created November 28, 2016 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TACIXAT/9ddf82c879c5f760a5bd83922d1a088d to your computer and use it in GitHub Desktop.
Save TACIXAT/9ddf82c879c5f760a5bd83922d1a088d to your computer and use it in GitHub Desktop.
Python XorShift128Plus Algorithm
def xs128p(state0, state1):
s1 = state0
s0 = state1
s1 ^= (s1 << 23)
s1 ^= (s1 >> 17)
s1 ^= s0
s1 ^= (s0 >> 26)
state0 = state1
state1 = s1
generated = (state0 + state1)
return state0, state1, generated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment