rand-nth follows the reference shape; refresh doc counts and the corpus floor

rand-nth vec'd its argument, so (rand-nth nil) hit index-out-of-bounds
through the empty vector where the reference's (nth coll (rand-int (count
coll))) returns nil (and a set throws) — the last genuinely-fixable row in
the suite baseline; rand-nth is fully clean now. Corpus/README counts
updated to the current ~3570 rows, the run-corpus regression floor raised
from 2730 to 3390 to match current parity, and the stale traceability line
dropped.
This commit is contained in:
Yogthos 2026-07-02 14:32:53 -04:00
parent ab10e68218
commit a67dbdb93d
7 changed files with 3578 additions and 3578 deletions

View file

@ -66,9 +66,10 @@
\backspace "backspace" \space "space"})
(defn char-name-string [c] (get char-name-strings c))
;; Random selection over the host rand primitives.
;; Random selection over the host rand primitives — the reference shape:
;; nth directly (nil returns nil via RT.nth; a set throws like the JVM).
(defn rand-nth [coll]
(let [v (vec coll)] (nth v (rand-int (count v)))))
(nth coll (rand-int (count coll))))
(defn random-sample
([prob] (filter (fn [_] (< (rand) prob))))