Skip to content

Instantly share code, notes, and snippets.

@rfl890
Created June 15, 2023 15:40
Show Gist options
  • Save rfl890/e0ad888543bd5300f4b848a15e261924 to your computer and use it in GitHub Desktop.
Save rfl890/e0ad888543bd5300f4b848a15e261924 to your computer and use it in GitHub Desktop.
local function rol64(x, k)
return (x << k) | (x >> (64 - k));
end
local function xoshiro256ss_step(state)
local result = rol64(state[2] * 5, 7) * 9;
local t = state[2] << 17;
state[3] = state[3] ~ state[1]; state[4] = state[4] ~ state[2]; state[2] = state[2] ~ state[3]; state[1] = state[1] ~ state[4];
state[3] = state[3] ~ t;
state[4] = rol64(state[3], 45);
return result
end
local state = { -0x7eee29779aec4ff0, 0x135abbf88fa57484, 0x3e1e2f0515496562, 0x59c068e8d7575616 }
for i = 1, 100 do
print(xoshiro256ss_step(state))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment