From d7e893d69f1689fe07bcaf4bb1f923dcb211bdfd Mon Sep 17 00:00:00 2001 From: ozh Date: Fri, 7 Feb 2014 15:14:50 +0100 Subject: [PATCH] Heh. Just found out about str_shuffle(). --- includes/functions.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index ac55ebe..7701160 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1449,11 +1449,7 @@ function yourls_rnd_string ( $length = 5, $type = 0, $charlist = '' ) { } - $i = 0; - while ($i < $length) { - $str .= substr( $possible, mt_rand( 0, strlen( $possible )-1 ), 1 ); - $i++; - } + $str = substr( str_shuffle( $possible ), 0, $length ); return yourls_apply_filter( 'rnd_string', $str, $length, $type, $charlist ); } -- 2.45.0