Search code examples
matlabgraphgeometrytopology

geometric random graph in a circle


I wanted to generate a set of coordinates distributed uniformly at random within a ball of radius R. Is there any way to do this in Matlab without for loops, in a matrix-like form?

Thanks

UPDATE: I'm sorry for the confusion. I only need to generate n points uniformly at random over a circle of radius R, not a sphere.


Solution

  • the correct answer is here http://mathworld.wolfram.com/DiskPointPicking.html. The distribution is known as "Disk point picking"