Skip to content

Instantly share code, notes, and snippets.

@unixpickle
Created April 10, 2017 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unixpickle/80a47e01e2953437081e4dd706a89552 to your computer and use it in GitHub Desktop.
Save unixpickle/80a47e01e2953437081e4dd706a89552 to your computer and use it in GitHub Desktop.
Uniform dist bias
n = 10000;
values = zeros(n,1);
for i=1:n
vec = rand(2,1)*2 - [1; 1];
vec /= norm(vec);
values(i) = (180 / pi) * atan2(vec(2), vec(1));
end
hist(values, 30);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment