$OpenBSD: patch-src_mpdpp_cpp,v 1.1 2015/01/29 10:39:10 dcoppa Exp $

commit af17e7eadf5d3bf3a2f28feccb37611bd69e4509
Author: Benoit Dardenne <benoit.dardenne@gmail.com>
Date:   Wed Jan 14 22:55:03 2015 +0100

mpd: fix floating point exception when adding random tags/songs

--- src/mpdpp.cpp.orig	Sat Dec 13 12:03:39 2014
+++ src/mpdpp.cpp	Thu Jan 29 04:25:02 2015
@@ -505,7 +505,7 @@ bool Connection::AddRandomTag(mpd_tag_type tag, size_t
 	else
 	{
 		std::random_shuffle(tags.begin(), tags.end());
-		auto it = tags.begin()+rand()%(tags.size()-number);
+		auto it = tags.begin();
 		for (size_t i = 0; i < number && it != tags.end(); ++i)
 		{
 			StartSearch(1);
@@ -546,7 +546,7 @@ bool Connection::AddRandomSongs(size_t number)
 	{
 		std::random_shuffle(files.begin(), files.end());
 		StartCommandsList();
-		auto it = files.begin()+rand()%(std::max(size_t(1), files.size()-number));
+		auto it = files.begin();
 		for (size_t i = 0; i < number && it != files.end(); ++i, ++it)
 			AddSong(*it);
 		CommitCommandsList();
