Skip to content

CAT 022

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-022 — shuffle.first → sample

Severity: infoConfidence: highAuto-fix:

Description

shuffle.first → sample — Use sample instead of shuffle + first to get a random element without shuffling the whole array.

Bad code

ary.shuffle.first

Benchmark

Note

See bench results at bench/cat-022/

Clone this wiki locally