protected function drawIndex(array $d)
     {
         $x = $this->mt->generate();
         $p = 0.0;
         foreach ($d as $i=>$v) {
             $p+=$v;
             if ($p > $x)
                return $i;
         }
     }