On 6/19/10, Daniel Moore <yahivin / gmail.com> wrote:
> The quiz this week
> is to generate random points uniformly distributed within a circle of
> a given radius and position.

def random_point_in_a_circle(x,y,r)
  angle=rand*2*Math::PI
  r*=rand
  x+=r*Math.sin(angle)
  y+=r*Math.cos(angle)

  return x,y
end

7 lines, 5 minutes, 0 tests or visualizations. Super-easy.