Verified Commit 326ae3a2 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

wallpapers/potd: Give random chooser a seed in flickrprovider

Make the seed depend on the current date.

BUG: 453391
FIXED-IN: 5.24.6
parent d3bb3dc1
Pipeline #172097 passed with stage
in 1 minute and 27 seconds
......@@ -7,8 +7,9 @@
#include "flickrprovider.h"
#include <random>
#include <QDebug>
#include <QRandomGenerator>
#include <QRegularExpression>
#include <QUrlQuery>
......@@ -127,7 +128,11 @@ void FlickrProvider::xmlRequestFinished(KJob *_job)
}
if (m_photoList.begin() != m_photoList.end()) {
QUrl url(m_photoList.at(QRandomGenerator::global()->bounded(m_photoList.size())));
// Plasma 5.24.0 release date
std::mt19937 randomEngine(QDate(2022, 2, 3).daysTo(QDate::currentDate()));
std::uniform_int_distribution<int> distrib(0, m_photoList.size() - 1);
QUrl url(m_photoList.at(distrib(randomEngine)));
KIO::StoredTransferJob *imageJob = KIO::storedGet(url, KIO::NoReload, KIO::HideProgressInfo);
connect(imageJob, &KIO::StoredTransferJob::finished, this, &FlickrProvider::imageRequestFinished);
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment