One way would be to use poly2mask(), but bear in mind that your coordinate space changes. That may complicate the expense of testing points.
% Your MATLAB code for generating the shape
N = 5 + round(rand() * 10);
a = sort(rand(N, 1)) * 2 * pi;
r = 8 + rand(N, 1) * 0.6;
% Generate points
x = cos(a) .* r;
y = sin(a) .* r;
t = linspace(1, N, 100000 * N);
xi = interp1(1:N, x, t, 'pchip');
yi = interp1(1:N, y, t, 'pchip');
% Close the shape by adding the first point to the end
xi = [xi, xi(1)];
yi = [yi, yi(1)];
% Plot the original shape
figure(1);
plot(xi, yi);
xl = [-15, 15]; % need to know this later
yl = [-15, 15];
xlim(xl)
ylim(yl)
axis equal;
title('Irregular Shape');
% create an image of some size
% assume that the image edges correspond to the plot extents
% assume that the image should be rendered such that
% the object is not flipped
imsz = [501 501]; % image size [y x]
xmod = interp1(xl,[0.5 imsz(2)+0.5],xi); % rescale to image coordinates
ymod = interp1(yl,[0.5 imsz(1)+0.5],-yi);
mask = poly2mask(xmod,ymod,imsz(1),imsz(2));
% show the mask
figure
imshow(mask)