diff --git a/libs/brush/kis_imagepipe_brush.cpp b/libs/brush/kis_imagepipe_brush.cpp --- a/libs/brush/kis_imagepipe_brush.cpp +++ b/libs/brush/kis_imagepipe_brush.cpp @@ -105,6 +105,7 @@ int chooseNextBrush(const KisPaintInformation& info) override { quint32 brushIndex = 0; + bool isTipRandom = false; if (!m_isInitialized) { /** @@ -123,13 +124,28 @@ m_parasite.index[i], m_parasite.rank[i], info); + // if mode is random, pick a random brush tip + if (m_parasite.selection[i] | KisParasite::SelectionMode::Random ) { + isTipRandom = true; + } + brushIndex += m_parasite.brushesCount[i] * index; } - brushIndex %= m_brushes.size(); + + + if (isTipRandom) { + qsrand(QTime::currentTime().msec()); // generates a new seed to make random number more random + brushIndex = qrand() % m_brushes.size(); + } else { + brushIndex %= m_brushes.size(); // brush index we will use + } + + return brushIndex; } void updateBrushIndexes(const KisPaintInformation& info, int seqNo) override { + for (int i = 0; i < m_parasite.dim; i++) { m_parasite.index[i] = selectPost(m_parasite.selection[i], m_parasite.index[i],