% Program to numerically determine the probability of selecting two % balls of the same color from an urn containing two black, two blue % and two white balls. bs = 'bbkkww' ; % 'b' for blue, 'k' for black, 'w' for white N = 10000 ; % Number of trials cnt = 0 ; % Count of number of times two balls drawn % have the same color for n = 1:N, % Perform N trials I = randperm(6) ; % Randomly scramble the ball order bs = bs(I) ; if % If the first two balls are the same color, increment the count bs(1) == bs(2), cnt = cnt + 1 ; end end % Display the computed probability disp(['Probability = ',num2str(cnt/N)]) ; Results of several runs of this program. Probability = 0.2038 Probability = 0.1981 Probability = 0.2081 Probability = 0.2013 Probability = 0.2014 Probability = 0.2012 Probability = 0.1921 Probability = 0.1994 Probability = 0.2091 Probability = 0.1917 Probability = 0.2037