Last active
August 29, 2015 14:13
-
-
Save glabra/bfb1b7e4bbb3cfecc3e1 to your computer and use it in GitHub Desktop.
Xorshift on APL
This file contains 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
_IB←32 | |
_SD←123456789 362436069 521288629 88675123 | |
∇R←A Xor B | |
R←(_IB⍴2)⊥1=((_IB⍴2)⊤B)+(_IB⍴2)⊤A | |
⍫ | |
∇R←BITS Shl IN | |
R←(_IB⍴2)⊥(BITS↓(_IB⍴2)⊤IN),BITS⍴0 | |
⍫ | |
∇R←BITS Lshr IN | |
R←(_IB⍴2)⊥(BITS⍴0),(-BITS)↓(_IB⍴2)⊤IN | |
⍫ | |
∇R←Rnd;t | |
t←_SD[1] Xor 11 Shl _SD[1] | |
_SD←_SD[2 3 4],(_SD[4] Xor 19 Lshr _SD[4]) Xor t Xor 8 Lshr t | |
R←_SD[4] | |
⍫ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
関数の書き換えを禁止するようにした