These lines define your circle for each point theta
xmax=B*cos(theta)+xhat;
ymax=B*sin(theta)+yhat;
All you need to do is define theta as random values between 0 and 2pi to plot random points on the circle.
B = 5;
xhat = 3;
yhat = -2;
theta = linspace(-pi,pi,500);
xmax=B*cos(theta)+xhat;
ymax=B*sin(theta)+yhat;
plot(xmax,ymax)
axis equal
n = 20; % number of random points
rng('default')
thetaRand = rand(1,n) * 2*pi;
xp=B*cos(thetaRand)+xhat;
yp=B*sin(thetaRand)+yhat;
hold on
plot(xp,yp,'o')


