replace open-coded rand_bool()