I had looked these topics but they don't resolve my problem:
Uniformly distribute x points inside a circle
Generate a random point within a circle (uniformly)
My problem is:
- Randomly distribute n of points between 2 circles.
What I have:
- The count of points: n
- The center: (x, y)
- The radius: r1, r2
Any algorithm to randomly distribute n of points between 2 circles?
Thank you very much!
p/s: I am familiar with C#, C family and pseudo code.
Update This is my attempt. Let's say the center is (0, 0) (for easier looking)
Vector2[] points = new Vector2[n];
for (int i = 0; i < n; ++i)
{
do
{
points[n] = new Vector2(Random.Range(0f, r2), Random.Range(0f, r2));
} while (points[n].magnitude >= r2 || points[n].magnitude <= r1);
}