
private ["_lo", "_hi"];

_arrays = _this select 0;

_array = _arrays select 0;
_lo = _this select 1;
_hi = _this select 2;

_i = _this select 1;
_j = _this select 2;

_mid = (_lo + _hi) / 2;
_mid = _mid - (_mid mod 1);
_x = _array select _mid;



while "_i <= _j" do
{
	while "  (_array select _i) < _x  " do {_i=_i+1};
	while "  (_array select _j) > _x  " do {_j=_j-1};
		
	if (_i <= _j) then
	{
		_k=0;
		while "_k < count _arrays" do
		{
			_currentARR = _arrays select _k;
			_h = _currentARR select _i;
			_currentARR set [_i, (_currentARR select _j)];
			_currentARR set [_j, _h];
			_arrays set [_k, _currentARR];
			_k=_k+1;
		};
		
		_i = _i + 1;
		_j = _j - 1;
	};
};



if ( _lo < _j )  then  { [_arrays, _lo, _j] call quicksort2 };
if ( _i < _hi )  then  { [_arrays, _i, _hi] call quicksort2 };

_arrays
