Index: src/wp-includes/pluggable.php
===================================================================
--- src/wp-includes/pluggable.php	(revision 34451)
+++ src/wp-includes/pluggable.php	(working copy)
@@ -2131,30 +2131,51 @@ if ( !function_exists('wp_rand') ) :
 /**
  * Generates a random number
  *
  * @since 2.6.2
  *
  * @global string $rnd_value
  * @staticvar string $seed
  *
  * @param int $min Lower limit for the generated number
  * @param int $max Upper limit for the generated number
  * @return int A random number between min and max
  */
 function wp_rand( $min = 0, $max = 0 ) {
 	global $rnd_value;
 
+	// We're only dealing with int's
+	$min = (int) $min;
+	$max = (int) $max;
+
+	// Use an external source?
+	static $external_rand_source_available = true;
+	if ( $external_rand_source_available ) {
+		try {
+			$val = random_int( min( $min, $max ), max( $min, $max ) );
+			if ( false !== $val ) {
+				return abs( $val );
+			} else {
+				$external_rand_source_available = false;
+			}
+		} catch ( Throwable $t ) { 
+			$external_rand_source_available = false;
+		} catch ( Exception $e ) {
+			$external_rand_source_available = false;
+		}
+	}
+
 	// Reset $rnd_value after 14 uses
 	// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
 	if ( strlen($rnd_value) < 8 ) {
 		if ( defined( 'WP_SETUP_CONFIG' ) )
 			static $seed = '';
 		else
 			$seed = get_transient('random_seed');
 		$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
 		$rnd_value .= sha1($rnd_value);
 		$rnd_value .= sha1($rnd_value . $seed);
 		$seed = md5($seed . $rnd_value);
 		if ( ! defined( 'WP_SETUP_CONFIG' ) && ! defined( 'WP_INSTALLING' ) ) {
 			set_transient( 'random_seed', $seed );
 		}
 	}
Index: src/wp-includes/compat.php
===================================================================
--- src/wp-includes/compat.php	(revision 34451)
+++ src/wp-includes/compat.php	(working copy)
@@ -248,15 +248,19 @@ function hash_equals( $a, $b ) {
 
 	// Do not attempt to "optimize" this.
 	for ( $i = 0; $i < $a_length; $i++ ) {
 		$result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
 	}
 
 	return $result === 0;
 }
 endif;
 
 // JSON_PRETTY_PRINT was introduced in PHP 5.4
 // Defined here to prevent a notice when using it with wp_json_encode()
 if ( ! defined( 'JSON_PRETTY_PRINT' ) ) {
 	define( 'JSON_PRETTY_PRINT', 128 );
 }
+
+if ( ! function_exists( 'random_int' ) ) {
+	include ABSPATH . WPINC . '/random_compat/random.php';
+}
\ No newline at end of file
