Shuffle update urls
This commit is contained in:
		
							parent
							
								
									b2f5cc93f2
								
							
						
					
					
						commit
						7e73804348
					
				@ -11,6 +11,8 @@
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
 | 
			
		||||
#include <random>
 | 
			
		||||
 | 
			
		||||
namespace update
 | 
			
		||||
{
 | 
			
		||||
namespace
 | 
			
		||||
@ -311,8 +313,13 @@ std::unique_ptr<Model::Component> Model::parse(const QJsonObject &json) const
 | 
			
		||||
        if (url.isValid())
 | 
			
		||||
          file.urls.append(url);
 | 
			
		||||
      }
 | 
			
		||||
      if (file.urls.isEmpty())
 | 
			
		||||
      if (file.urls.isEmpty()) {
 | 
			
		||||
        result->checkOnly = true;
 | 
			
		||||
      } else if (file.urls.size() > 1) {
 | 
			
		||||
        std::random_device device;
 | 
			
		||||
        std::mt19937 generator(device());
 | 
			
		||||
        std::shuffle(file.urls.begin(), file.urls.end(), generator);
 | 
			
		||||
      }
 | 
			
		||||
      file.rawPath = object["path"].toString();
 | 
			
		||||
      file.md5 = object["md5"].toString();
 | 
			
		||||
      file.versionDate =
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user