• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/userqueue.php
  • Класс: BitrixIntranetUserQueue
  • Вызов: UserQueue::random
public function random()
{
	if (count($this->list) == 0)
	{
		return null;
	}

	$item = null;
	$length = count($this->list);
	for ($i = 0; $i < 3; $i++)
	{
		$index = mt_rand(0, $length - 1);
		if (!isset($this->list[$index]))
		{
			return null;
		}

		$item = $this->list[$index];
		if ($item === $this->current())
		{
			$item = null;
			break;
		}

		if (!$this->filterItem($item))
		{
			$item = null;
			continue;
		}

		break;
	}

	if (!$item)
	{
		return $this->next();
	}

	$this->setLastItem($item);

	if ($this->isAutoSaveEnabled)
	{
		$this->save();
	}

	return $item;
}