Logo Search packages:      
Sourcecode: kanagram version File versions  Download package

void KanagramGame::createAnagram (  ) [private]

make the word into an anagram

Definition at line 230 of file kanagramgame.cpp.

References m_anagram, m_originalWord, and m_random.

Referenced by nextAnagram().

{
    QStringList objData = m_originalWord.split(QString(""));
    QString insaneData;
    do
    {
        insaneData = "";
        int count;

        for (int i = 0; (count = objData.count()); i++)
        {
            int objChunk;
            if ((i == 0) && (count > 1))
            {
                objChunk = 1 + m_random.getLong(count - 1);
            }
            else
            {
                objChunk = m_random.getLong(count);
            }

            QString sd = objData.at(objChunk);
            objData.removeAt(objChunk);
            insaneData += sd;
        }
        // go again if we got the original word
    } while (insaneData == m_originalWord);

    m_anagram = insaneData;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index