1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function [count1,count2,count3] = catchball()

R_ball=0.3;
G_ball=0.5;
B_ball=0.2;

count1=0;
count2=0;
count3=0;

for i=1:100
slecet=rand();

if slecet >=1-R_ball
%output = 'R_ball';
count1=count1+1;
elseif slecet >=1-R_ball-G_ball
%output = 'G_ball';
count2=count2+1;
else
%output = 'B_ball';
count3=count3+1;
end

end