```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Random points in a circular zone
Date: Wed, 23 May 2012 08:42:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <jpi7su\$g55\$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1337762526 16549 172.30.248.46 (23 May 2012 08:42:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 May 2012 08:42:06 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:768716

Hi, I want to create a function that give me N random points in a circular zone.

The circular zone can be represented as
A={(x,y)=(R*cos(theta), R*t*sin(theta)), t in [-1, 1], theta in [a,b]}
where 0<a<b<pi.

I have written a function for the circular segment, that is when a=0, but this function doesn't give me a uniform distribution and I don't understand how apply it to the zone.

function [x,y]= RandSeg(N, R, w)
angle = -w+2*w*rand(N,1);    % theta is in [0, w]
k=linspace(-1,1,N)';
x=R.*cos(angle);
y=R.*k.*sin(angle);

Can anyone help me?
Thank you!
Valentina
```