Commit 93b7a3cdc9523c29316ecb57d1b8e43b643206f9

Authored by Charles Otto
1 parent 1bf9c77c

Modify dbGallery to actually give deterministic output

Make a call to qSort prior to shuffling the records received by a dbGallery
this makes the output of a dbGallery deterministic for a given query (as long
as the seed is set).
Showing 1 changed file with 2 additions and 2 deletions
sdk/plugins/gallery.cpp
... ... @@ -590,10 +590,10 @@ class dbGallery : public Gallery
590 590 }
591 591  
592 592 QStringList labels = entries.keys();
  593 + qSort(labels);
  594 +
593 595 if (hasFilter && ((labels.size() > numSubjects) || (numSubjects == std::numeric_limits<int>::max())))
594 596 std::random_shuffle(labels.begin(), labels.end());
595   - else
596   - qSort(labels);
597 597  
598 598 foreach (const QString &label, labels) {
599 599 QList<Entry> entryList = entries[label];
... ...