Pergunta de entrevista da empresa Google

Sample uniformly on a circle centered at zero with radius 1.

Respostas da entrevista

Sigiloso

4 de mar. de 2011

randomly choose points in the rectangular from (-1,-1) to (1,1) and delete those points that fall out of the circle by checking x^2 + y^2 <=1.

Sigiloso

5 de dez. de 2011

randomly generate an integer X. we know that cos(X)^2 + sin(X)^2 = 1, so just use xx = cos(X) and yy = sin(X) I think that was the whole point of the question (and I don't like it very much)