Shuffles an associative array

@param array $list

@return array
503599
protected function arrayShuffle($list)
    {
        $keys = array_keys($list);
        shuffle($keys);

        $new = [];
        foreach ($keys as $key) {
            $new[$key] = $list[$key];
        }

        return $new;
    }
1047507
public function setWhiteList(array $list)
    {
        $list = array_unique(array_filter(array_map('trim', array_values($list))));
        sort($list);
        if ($this->whiteList !== $list) {
            $this->clear();
            $this->whiteList = $list;
        }
        return $this;
    }
496858
public function shuffle(bool $secure = false, array $array = null): self
    {
        if ($array === null) {
            $array = $this->getArray();
        }

        if ($secure !== true) {
            /** @noinspection NonSecureShuffleUsageInspection */
            \shuffle($array);
        } else {
            $size = \count($array, \COUNT_NORMAL);
            $keys = \array_keys($array);
            for ($i = $size - 1; $i > 0; --$i) {
                try {
                    $r = \random_int(0, $i);
                } catch (\Exception $e) {
                    /** @noinspection RandomApiMigrationInspection */
                    $r = \mt_rand(0, $i);
                }
                if ($r !== $i) {
                    $temp = $array[$keys[$r]];
                    $array[$keys[$r]] = $array[$keys[$i]];
                    $array[$keys[$i]] = $temp;
                }
            }

            // reset indices
            $array = \array_values($array);
        }

        foreach ($array as $key => $value) {
            // check if recursive is needed
            if (\is_array($value) === true) {
                $array[$key] = $this->shuffle($secure, $value);
            }
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
200310
public function shuffle()
    {
        $keys = array_keys($this->items);
        shuffle($keys);

        $new = [];
        foreach ($keys as $key) {
            $new[$key] = $this->items[$key];
        }

        $this->items = $new;

        return $this;
    }
1373845
protected function listifyObjectList($array)
    {
        ksort($array);
        $list = array();
        foreach ($array as $obj) {
            $list[] = $this->getClass($obj, 'AttrTransform_');
        }
        return $this->listify($list);
    }
1178801
protected function filter(array $list)
    {
        $tmp = [];
        foreach ($list as $item) {
            if ($item['anime']) {
                $tmp[] = $item;
            }
        }
        return $tmp;
    }
738201
static public function throughListFieldToArray($list, $field)
    {
        if (function_exists("array_column")) {
            return array_column($list, $field);
        }

        $array = [];
        foreach ($list as $row) {
            $array[] = $row[$field];
        }
        return $array;
    }
1005680
public function mung(array $list)
    {
        foreach ($list as $value) {
            if (false === in_array($value, self::$allowedMung)) {
                throw InvalidArgumentException::create(
                    'The $_SERVER variable "%s" is not allowed.',
                    $value
                );
            }
        }

        $this->mung = $list;

        return $this;
    }
11821
public static <E> void shuffle(List<E> list) {
        int swapPlace = -1;
        
        for(int i = 0; i < list.size(); i++) { 
            swapPlace = (int) (Math.random() * (list.size() - 1));
            TrivialSwap.swap(list, i, swapPlace);
        }
	}
527985
function shuffleArray(array){
    var length = array.length;
    var randomIndex;
    var currentIndex = 0;
    var tmp;
    for (; currentIndex < length; currentIndex++) {
        randomIndex = Math.floor(Math.random() * length);
        tmp = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = tmp;
    }
    return array;
}
727464
private function finish($list)
    {
        if (is_array($list) || ($list instanceof ArrayObject)) {
            foreach ($list as $index => $item) {
                $list[$index] = $this->finish($item);
            }

            if ($list instanceof ArrayObject) {
                $list = $list->getArrayCopy();
            }
        } elseif (is_object($list)) {
            $list->values = $this->finish($list->values);
        }

        return $list;
    }
200544
function shuffle(arr) {
  if (!Array.isArray(arr)) {
    throw new Error('expected an array');
  }
  var len = arr.length;
  var result = Array(len);
  for (var i = 0, rand; i < len; i++) {
    rand = Math.floor(Math.random() * i);
    if (rand != i) {
      result[i] = result[rand];
    }
    result[rand] = arr[i];
  }
  return result;
}
927289
public function fromArray( array $list )
	{
		$unknown = array();
		$list = parent::fromArray( $list );

		foreach( $list as $key => $value )
		{
			switch( $key )
			{
				case 'order.base.address.baseid': $this->setBaseId( $value ); break;
				case 'order.base.address.addressid': $this->setAddressId( $value ); break;
				case 'order.base.address.type': $this->setType( $value ); break;
				default: $unknown[$key] = $value;
			}
		}

		return $unknown;
	}
1109815
function shuffle(a) {
  var n = a.length;
  for (var i = n - 1; i > 0; i--) {
    var j = Math.random() * i | 0; // 0 ≤ j < i
    var t = array[j];
    array[j] = array[i];
    array[i] = t;
  }
  return a;
}
894394
public static function sortRecursive($array)
    {
        foreach ($array as &$value) {
            if (is_array($value)) {
                $value = static::sortRecursive($value);
            }
        }

        if (static::isAssociative($array)) {
            ksort($array);
        } else {
            sort($array);
        }

        return $array;
    }
1372055
private static function array_shuffle(array &$array)
    {
        for($i = count($array) - 1; $i > 0; $i--)
        {
            $j = mt_rand(0,$i);
            $temp = $array[$i];
            $array[$i] = $array[$j];
            $array[$j] = $temp;
        }
    }
1025169
public static void shuffle(int[] arr, Random rand) {
        int size = arr.length;
        for (int i = size; i > 1; i--) {
            int tmp = arr[i-1];
            int r = rand.nextInt(i);
            arr[i-1] = arr[r];
            arr[r] = tmp;
        }
    }