Uiua
It's been a while since I posted one of these, but I thought this would be straightforward in Uiua. Turns out that bitwise operations are a bit (haha) of a pain, so the Rng
operation is very slow at 4sec for live data.
I took this as an opportunity to play with the ⧈(stencil)
operator which probably slowed things down too.
Data ← 1_10_100_2024
Xor ← °⋯◿2⬚0+∩⋯ # Bitwise xor of two numbers.
Rng ← ⊙◌◿,Xor×2048.◿,Xor⌊÷32.◿,Xor×64.⊙16777216
Runs ← &p⍜now((⇌[⍥(Rng.)])2000 Data) # len seed
First ← (
⊟⊂0⧈₂/-.◿10 ↘¯1 # Build run, gen pair diffs
⍣⊢0▽⊸(>0)⊢⧈(⨬(⋅0|⊣)≍¯2_1_¯1_3°⊟) 2_4 # Take first value for matching diffs.
)
&p /+≡⊣Runs
&p /+≡First Runs