On Fri, 2023-11-17 at 15:32 -0500, Andrii Nakryiko wrote: [...] > > Well, r1 could be 0 as well, so idx would be out of bounds. > > But I like the idea, it is possible to check that r1 is either 00000, > > 100000, ..., 111111 and do something unsafe otherwise. > > then why not `return choice_arr[r <= 111111 ? (r & 1) : -1];` or > something along those lines? In theory, invalid value might be 100002 or something similar. I'll try writing down something more precise, if that would look too ugly would resort to the comparison that you suggest.