random_int: use rescaling instead of modulo
