use rand_bool everywhere instead of rand() % 2
device names can be const.