uni[mu_, s2_] := Random[Real, {mu - Sqrt[3 s2], mu + Sqrt[3 s2]}];

\(portfolio[A_List, s2_Real, mu_List, mix_Real, num_Integer] := 
	
      Module[{ser, sigma, returnser, unity, mean, var, mulist}, 
		
        ser = Table[{uni[0, s2], uni[0, s2]}, {num}]; 
		
        mulist = \ Table[mu, {num}]; 
	\ \ sigma = A\  . Transpose[A]; 

        		returnser = \((mulist + ser . sigma)\) . {mix, 1 - mix}; 
		
        unity = Table[1, {num}]; 
		mean = returnser . unity/num; 
		
        var = \((\((returnser\  - \ mean)\) . \((returnser\  - \ mean)\))\)/
            num; 
		{mean, var}
	]\)

\(gportfolio[A_List, s2_Real, mu_List, mix_List, num_Integer] := 
	
      Module[{ser, sigma, returnser, unity, mean, var, mulist, lnum}, 
		
        lnum = Length[mu]; 
		
        ser = Table[Table[uni[0, s2], {lnum}], {num}]; 
		
        mulist = Table[mu, {num}]; 
	\ \ sigma = A\  . Transpose[A]; 
		
        returnser = \((mulist + ser . sigma)\) . mix; 
		
        unity = Table[1, {num}]; 
		mean = returnser . unity/num; 
		
        var = \((\((returnser\  - \ mean)\) . \((returnser\  - \ mean)\))\)/
            num; 
		{mean, var}
	]\)

portfolio[{{1, 0.02}, {0, 1}}, 0.0001, {1.015, 1.02}, 0.5, 10]

Table[
      portfolio[{{1, 0.02}, {0, 1}}, 0.0001, {1.015, 1.02}, mix, 10], {mix, 
        0.0, 1.0, 0.5}]

A = {{1, 0.02}, {0, 1}};

s2 = 0.0001;

num = 20;

sigma = s2 A . Transpose[A]

mix = 0.5;

num = 20;

mu = {1.015, 1.02};

portfolio[A, s2, mu, mix, num]

Table[
        portfolio[{{1, 0.02}, {0, 1}}, 0.0001, {1.015, 1.02}, mix, 20], {mix, 
          0.0, 1.0, 0.002}] // ListPlot

AA = {{1, 0, 0}, {0, 1, 0.05}, {0, 0, 1}};

ss2 = 0.001;

mumu = {1.01, 1.024, 1.027};

?gportfolio

gportfolio[AA, ss2, mumu, {0.2, 0.3, 0.5}, 10]