# The following code is one method for simulating the average score from 3-pt shots that the basketball player # from our classroom example earns. This method simulates the individual shots. number_simulations := 100000: scores := array(1..number_simulations): for i from 1 to number_simulations do scores[i] := 0; u := rand()/10^12; if (u < .25) then shots := 0 elif (u<.5) then shots := 1 elif (u<.75) then shots := 2 else shots := 3 end if; for j from 1 to shots do; u := rand()/10^12; if (u < .1) then scores[i] := scores[i] + 3 end if; end do: end do: evalf(add(scores[i], i=1..number_simulations)/number_simulations);