xorshift


xorshiftは新しい擬似乱数。
Google ChromeのJavascriptでも採用された。

ABでxorshiftを実装。
#N88BASIC

Dim x = 123456789 As DWORD
Dim y = 362436069 As DWORD
Dim z = 521288629 As DWORD
Dim w = 88675123  As DWORD

Function xor128 () As DWORD
	Dim t As DWORD

	t = x xor (x << 11)
	x = y: y = z: z = w
	w = (w xor (w >> 19)) xor (t xor (t >> 8))
	xor128 = w
End Function

Dim i As Long

For i=0 To 10
	Print xor128()
Next