I wrote this code in Matlab and I am looking for equivalent code in Python. Can someone help? The code is to generate N Points inside a rectangle of side LxL with Gaussian Distribution. The code was obtained from this link: gaussian_inside_rectangle
function ans = randn_rect( N, sigma, L )
ans = zeros(0,2);
while size(ans,1) < N,
pts = sigma * randn( ceil(1.25*(N-size(ans,1))), 2 );
pts = pts(all(abs(pts)<L/2,2),:);
ans = [ ans ; pts ];
end
ans = ans(1:N,:);