Created
October 13, 2012 08:50
-
-
Save staticfloat/3883874 to your computer and use it in GitHub Desktop.
First attempt at implementation of WELL512a in Julia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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