function [f]=acceptloop(trials);

%Acceptance.m: The input argument to this function is a function 
%This function uses acceptance-rejection to generate the distribution
%P(x)=.75*(1-x^2) where -1<=x<=1

%Largest value the probability will reach

for i=1: trials
j=1;    
while j>0
    xtry=2*rand-1;
    if (1-xtry^2) >=rand, f(i)=xtry;j=0;end;
end
end