 
 // assuming x is random uniform in [0,1], return x < prob and make
 // x a new random uniform in [0, 1] independent of this choice
-bool random_choice(float prob, in out float x) {
+bool random_choice(float prob, inout float x) {
     if (x < prob) {
       x /= prob;
       return true;

    float sqrt_discr = sqrt(discr);
    float dist = -dotp - sqrt_discr;
    if (is_inside) {
      dist += sqrt_discr*2;
    }
    dist /= ray2;
    vec3 normal = (pos + ray*dist - sphere_pos) / sphere_r;

    return which_object;
}

int select_light(out vec3 light_point, out float sample_prob_density_per_area, inout float x) {
      light_point = normalize(light_sample) * light_r;
      sample_prob_density_per_area = 1.0 / (UNIT_SPHERE_AREA*light_r*light_r * float(N_LIGHTS));

