scripts/select-random: be more fault tolerant

Signed-off-by: Christopher Larson <kergoth@gmail.com>