pan class="comment">% to avoid repetition</span>
0023     <span class="keyword">end</span>
0024 <span class="keyword">end</span>
0025 
0026 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
0027 
0028 
0029 <a name="_sub1" href="#_subfunctions" class="code">function c = weighted_choice(w)</a>
0030 <span class="comment">% weighted_choice(w) --- choose an integer at random according to weights.</span>
0031 <span class="comment">% w is a list of nonnegative