Re:Uniformly Sample Points in a Disk
by 6gvONxR4sf7o on Thursday May 26, 2022 @10:43AM
(#31518937)
The logic is that independent standard normals on each axis make up the multivariate standard normal, and the multivariate standard normal is rotationally invariant and therefore has the same density at any angle.
It's a well-known method to uniformly sample the surface of an n-dimensional sphere.
I guess/think you misread the “standard normal” part in that sentence as “uniform”.
It appears to be uniform. I tested empirically in Python:
https://pastebin.com/raw/ca03uywJ
https://codepen.io/toxicfork/pen/OJQzLba
This says otherwise
I meant to show the output of my code, but Pasteboard was down at the time:
https://gcdnb.pbrd.co/images/f8bgGZMW3deq.png?o=1
Normal distribution is not the same as uniform distribution. I edited in a normal distribution sampler in your codepen example.
I see, thanks!
Btw, the following two are equivalent (in JavaScript syntax):
var a = Math.max(Math.random(), Math.random());
var b = Math.sqrt(Math.random());Curious, how come? Does it become a statistical thing?
Well, not sure whether you'd call it statistics. It's a mathematical fact from probability theory. And it doesn't matter how often you sample: the distributions themselves are the same.
I came across that one in the other direction, when trying to work out how to make weighted rendezvous hashing work. See https://en.wikipedia.org/wiki/Rendezvous_hashing
I wonder if that's uniform...
I expect that you would have more points mapped to the corners.