Nit: SQLite `random()` returns a full 64-bit signed integer, so `random() < 0.5` in SQLite is (very) slightly different from others. The relevant portion of SQLite source code by the way is the `pushDownWhereTerms` function in select.c [1]; apparently it doesn't do the deterministic function check (i.e. `SQLITE_FUNC_CONSTANT`).
[1] https://www.sqlite.org/src/info/64c9bc7494f3d220a27498137551...