Skip to content

Instantly share code, notes, and snippets.

@staticfloat
Created October 13, 2012 08:50
Show Gist options
  • Select an option

  • Save staticfloat/3883874 to your computer and use it in GitHub Desktop.

Select an option

Save staticfloat/3883874 to your computer and use it in GitHub Desktop.
First attempt at implementation of WELL512a in Julia
index = 0
state = [randi(Uint32) for x = 1:16]
function getstate(index)
global state
return state[index + 1]
end
function WELL()
global index
z0 = getstate((index+15) & 0x0000000f)
z1 = (getstate(index)^(getstate(index)<<16)) ^ (getstate((index+13) & 0x0000000f)^(getstate((index+13) & 0x0000000f)<<15))
z2 = getstate((index+9) & 0x0000000f)^(getstate((index+9) & 0x0000000f)>>11)
newV1 = z1 ^ z2
newV0 = (z0^(z0<<2)) ^ (z1^(z1<<18)) ^ (z2<<28) ^ (newV1^((newV1<<5)&0xda442d24))
index = (index+ 15) & 0x0000000f
return float64((getstate(index)) * 2.32830643653869628906e-10)
end
z = Array(Float64,10)
for i=1:10
z[i] = WELL()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment