Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,31 @@
function [xCoordinates,yCoordinates] = randomDisc(numPoints)
xCoordinates = [];
yCoordinates = [];
%Helper function that samples a random integer from the uniform
%distribution between -15 and 15.
function nums = randInt(n)
nums = round((31*rand(n,1))-15.5);
end
n = numPoints;
while n > 0
x = randInt(n);
y = randInt(n);
norms = sqrt((x.^2) + (y.^2));
inBounds = find((10 <= norms) & (norms <= 15));
xCoordinates = [xCoordinates; x(inBounds)];
yCoordinates = [yCoordinates; y(inBounds)];
n = numPoints - numel(xCoordinates);
end
xCoordinates(numPoints+1:end) = [];
yCoordinates(numPoints+1:end) = [];
end

View file

@ -0,0 +1,2 @@
>> [x,y] = randomDisc(100);
>> plot(x,y,'.')