   return normalize(sp * dist);
 }
 
+/// @return Point inside or on surface of sphere of radius one.
+vec2 rand_in_unit_disk(inout highp uint32_t seed)
+{
+  vec2 candidate;
+  while(true){
+    candidate = rand_point_2d(seed);
+    if(length_squared(candidate) <= 1.0f){
+      break;
+    }
+  }
+  return candidate;
+}
+
 /// @}
 
 #endif // KRUST_UTILS_INC_INCLUDED

  return vec3(x, y, z);
}

/// @return Point inside or on surface of sphere of radius one.
vec3 rand_point_in_unit_sphere(inout highp uint32_t seed)
{

/// @file Utilities used widely in shaders.

float length_squared(in const vec3 v)
{
    return dot(v, v);
}

float length_squared(in const vec2 v)
{
    return dot(v, v);
}
