Index: wp-includes/query.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/query.php	(date 1421442890000)
+++ wp-includes/query.php	(revision )
@@ -3383,8 +3383,19 @@
 
 		if ( ! empty($groupby) )
 			$groupby = 'GROUP BY ' . $groupby;
-		if ( !empty( $orderby ) )
+		if ( !empty( $orderby ) ) {
 			$orderby = 'ORDER BY ' . $orderby;
+
+			/**
+			 * Replace the standard MySQL rand() with an improved version.
+			 *
+			 * @link https://core.trac.wordpress.org/ticket/18836
+			 * @link http://stackoverflow.com/a/25882872
+			 */
+			if ( 0 === strcasecmp( $orderby, 'ORDER BY RAND()' ) ) {
+				$orderby = "AND ( rand() <= " . $q['posts_per_page'] . " * 2 / ( SELECT count(*) FROM $wpdb->posts $join WHERE 1=1 $where $groupby ) )";
+			}
+		}
 
 		$found_rows = '';
 		if ( !$q['no_found_rows'] && !empty($limits) )
