function [Dis_BStoRIS, Dis_BStoUser, Dis_RIStoUser]=Position_generate(B,R,K,dist)
Dis_BStoRIS=zeros(B,R);
Dis_BStoUser=zeros(B,K);
Dis_RIStoUser=zeros(R,K);

% BS_position=zeros(B,2);
% BS_position(1,:)=[0 20];
% BS_position(2,:)=[0 -20];
% % BS_position(3,:)=[60 15];
% % BS_position(4,:)=[60 -15];
% 
% RIS_position=zeros(R,2);
% RIS_position(1,:)=[30 3];
% RIS_position(2,:)=[45 -3];
% % RIS_position(3,:)=[70 3];
% % RIS_position(4,:)=[80 -3];

BS_position=zeros(B,2);
BS_position(1,:)=[0 -40];
% BS_position(2,:)=[80 -20];
% BS_position(3,:)=[60 15];
% BS_position(4,:)=[60 -15];

RIS_position=zeros(R,2);
RIS_position(1,:)=[60 10];
% RIS_position(2,:)=[50 3];
% RIS_position(3,:)=[70 3];
% RIS_position(4,:)=[80 -3];

angle1=2*pi*rand();
angle2=2*pi*rand();
angle3=2*pi*rand();
angle4=2*pi*rand();

user_position=zeros(K,2);
% user_position(1,:)=[dist+cos(angle1) sin(angle1)];
% user_position(2,:)=[dist+cos(angle2) sin(angle2)];
% user_position(3,:)=[dist+cos(angle3) sin(angle3)];
% user_position(4,:)=[dist+cos(angle4) sin(angle4)];
user_position(1,:)=[dist 0];
%user_position(2,:)=[dist 0];
%user_position(3,:)=[dist 0];
%user_position(4,:)=[dist 0];
% user_position(5,:)=[dist+4*(rand()-0.5) 4*(rand()-0.5)];
% user_position(6,:)=[dist+4*(rand()-0.5) 4*(rand()-0.5)];
for b=1:B
    for r=1:R
        BS_position_temp=reshape(BS_position(b,:),2,1);
        RIS_position_temp=reshape(RIS_position(r,:),2,1);
        Dis_BStoRIS(b,r)=distance(BS_position_temp,RIS_position_temp);
    end
end

for b=1:B
    for k=1:K
        BS_position_temp=reshape(BS_position(b,:),2,1);
        user_position_temp=reshape(user_position(k,:),2,1);
        Dis_BStoUser(b,k)=distance(BS_position_temp,user_position_temp);
    end
end

for r=1:R
    for k=1:K
        user_position_temp=reshape(user_position(k,:),2,1);
        RIS_position_temp=reshape(RIS_position(r,:),2,1);
        Dis_RIStoUser(r,k)=distance(RIS_position_temp,user_position_temp);
    end
end

end