Random pair of primes Given a positive input \$n\$, output a random pair of primes whose difference is \$n\$. It's fine if there's another prime between them.
Every pair should possibly appear and the program should have zero possibility to fall into infinite loop.
It's promised that such pair exist, but not always infinite, so beware. You also shouldn't assume it's infinite for even \$n\$ until a proof exist.
Test cases:
2 -&gt; [3,5], [11,13], [29,31], etc.
3 -&gt; [2,5]
4 -&gt; [3,7], [19,23], etc.
7 -&gt; Undefined behavior

Shortest code win.
05AB1E, 13 bytes
Generates a random integer \$k\$ until both \$k\$ and \$k+n\$ are prime.
[Î‚[&gt;₄Ω#}DpP#

Try it online! Runs the program 1000 times and shows the unique results.
Commented:
[              # loop:
 Î‚            # push [0, input]
   [    }      # loop:
    &gt;          #   increment both integers
     ₄Ω        #   draw a random digit of 1000
       #       #   if this is 1, stop the loop
         D     # duplicate the current pair
          p    # for both integers: are they prime?
           P   # take the product
            #  # if both are prime, end the main loop


Old answer that always just generates one random integer, 22 bytes:
∞+∞ø.ΔpP}D[₄Ω#&gt;}DpP_i\

Try it online! Runs the program 100 times to demonstrate different outputs.
∞+∞ø.ΔpP} finds the first valid pair.
[₄Ω#&gt;} is a loops which increments the pair and has a \$50\%\$ probability to stop at every iteration.
DpP_i\ removes the new pair if any of the numbers is not prime.