Example #1
0
 function array_random(array $array, $num = 1)
 {
     return array_random_callback($array, function () {
         $ramdom = ramdom_int();
         return $ramdom !== false ? floatval($ramdom) / floatval(PHP_INT_MAX + 1.0) : floatval(mt_rand()) / floatval(mt_getrandmax() + 1.0);
     }, $num);
 }
Example #2
0
 function mb_str_random_shuffle($str, $encoding = null)
 {
     return func_num_args() < 2 ? mb_str_random_shuffle_callback($str, function ($max) {
         return ramdom_int(0, $max) ?: mt_rand(0, $max);
     }) : mb_str_random_shuffle_callback($str, function ($max) {
         return ramdom_int(0, $max) ?: mt_rand(0, $max);
     }, $encoding);
 }