public function shuffle() 
    {
        $shuffling = clone $this;
        $groups = $shuffling->getShufflingGroups();
        
        for ($i = 0; $i < count($groups); $i++) {
            $identifiers = $groups[$i]->getIdentifiers();
            $fixedIdentifiers = $groups[$i]->getFixedIdentifiers()->getArrayCopy();
            $shufflableIndexes = array();
            
            // Find shuffblable indexes.
            for ($n = 0; $n < count($identifiers); $n++) {
                if (in_array($identifiers[$n], $fixedIdentifiers) === false) {
                    $shufflableIndexes[] = $n;
                }
            }
            
            // Shuffle the new group.
            $n = count($shufflableIndexes) - 1;
            for ($j = $n; $j > 0; $j--) {
                $k = mt_rand(0, $n);
                
                $tmp1 = $identifiers[$shufflableIndexes[$j]];
                $tmp2 = $identifiers[$shufflableIndexes[$k]];
                
                $identifiers[$shufflableIndexes[$j]] = $tmp2;
                $identifiers[$shufflableIndexes[$k]] = $tmp1;
            }
        }
        
        return $shuffling;
    }