Shuffle the items in the collection.

@param  int $seed

@return static
436334
public function shuffle($seed = null)
    {
        $items = $this->items;

        if (is_null($seed)) {
            shuffle($items);
        } else {
            srand($seed);

            usort($items, function () {
                return rand(-1, 1);
            });
        }

        return new static($items);
    }
141662
public function clear()
	{
		$this->seed      = false;
		$this->pattern   = array();
		$this->prefixes  = array();
		$this->suffixes  = array();
		$this->modifiers = array();

		return $this;
	}
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;
        }
    }
178634
public static <E> void shuffle(E[] array) {
		int swapPlace = -1;
		
		for(int i = 0; i < array.length; i++) {
            swapPlace = (int) (Math.random() * (array.length - 1 ));
            TrivialSwap.swap(array, i, swapPlace);
		}
	}
992234
public function shuffle() : Collection
    {
        $temp = $this->toArray();
        $keys = array_keys($temp);
        shuffle($keys);
        $rslt = [];
        foreach ($keys as $key) {
            $rslt[$key] = $temp[$key];
        }
        return new static($rslt);
    }
319170
private function randomizeSuiteThatContainsOtherSuites($suite, $seed)
    {
        $order = 0;
        foreach ($suite->tests() as $test) {
            if ($test instanceof \PHPUnit\Framework\TestSuite && $this->testSuiteContainsOtherSuites($test)) {
                $this->randomizeSuiteThatContainsOtherSuites($test, $seed);
            }
            if ($test instanceof \PHPUnit\Framework\TestSuite) {
                $this->randomizeSuite($test, $seed, $this->order);
            }
            $this->order++;
        }
        return $this->randomizeSuite($suite, $seed, $this->order, false);
    }
687751
public function natsort(): Collection
    {
        $index = 0;
        $items = $this->items;

        foreach ($items as &$item) {
            $item = [$index++, $item];
        }

        uasort($items, function ($a, $b) {
            $result = strnatcmp($a[1], $b[1]);

            return $result === 0 ? $a[0] - $b[0] : $result;
        });

        foreach ($items as &$item) {
            $item = $item[1];
        }

        return new static($items);
    }
1008565
protected function shuffleCloud()
    {
        if (self::$debugDisableShuffle) {
            return;
        }

        $keys = array_keys($this->wordsArray);

        shuffle($keys);

        if (count($keys) && is_array($keys)) {

            $tmpArray = $this->wordsArray;

            $this->wordsArray = array();
            foreach ($keys as $value) {
                $this->wordsArray[$value] = $tmpArray[$value];
            }

        }
    }
588185
def _shuffled(seq):
    """"""
    fixed_random = random.Random()
    if six.PY2:  # pragma: no cover (py2)
        fixed_random.seed(FIXED_RANDOM_SEED)
    else:  # pragma: no cover (py3)
        fixed_random.seed(FIXED_RANDOM_SEED, version=1)

    seq = list(seq)
    random.shuffle(seq, random=fixed_random.random)
    return seq
824205
public static void Shuffle(double[] array, long seed) {
        Random random = new Random();
        if (seed != 0) random.setSeed(seed);

        for (int i = array.length - 1; i > 0; i--) {
            int index = random.nextInt(i + 1);
            double temp = array[index];
            array[index] = array[i];
            array[i] = temp;
        }
    }
16387
public function addSeedBatch($seedBatch)
    {
        $this->seedBatches[] = $seedBatch;

        if (method_exists(get_class($this), 'setProducer')) {
            $seedBatch->setProducer($this);
        }

        return $this;
    }
1167529
public function random($amount = 1)
    {
        if ($amount > ($count = $this->count())) {

            throw new InvalidArgumentException("You requested {$amount} items, but there are only {$count} items in the collection.");
        }

        $keys = array_rand($this->items, $amount);

        if (count(func_get_args()) == 0) {

            return $this->items[ $keys ];
        }

        $keys = !is_array($keys) ? [$keys] : $keys;

        return new static(array_intersect_key($this->items, array_flip($keys)));
    }
503696
async def shuffle(self):
        """"""

        self.logger.debug("shuffle command")

        if not self.state == 'ready':
            return

        self.statuslog.debug("Shuffling")

        random.shuffle(self.queue)

        self.update_queue()
        self.statuslog.debug("Shuffled")
862255
public function add($seed, $region = null)
    {
        if (!$this->layout) {
            throw new Exception(['If you use $app->add() you should first call $app->setLayout()']);
        }

        return $this->layout->add($seed, $region);
    }
1071146
public function seed($seed = null)
    {  
        if($seed === null) {
            $seed = 0;
        }
        
        return $this->seed = abs(intval($seed)) % 9999999 + 1;  
    }
758333
public function randomMutable(int $number = null): self
    {
        $this->generatorToArray();

        if (\count($this->array, \COUNT_NORMAL) === 0) {
            return static::create(
                [],
                $this->iteratorClass,
                false
            );
        }

        if ($number === null) {
            /** @noinspection NonSecureArrayRandUsageInspection */
            $arrayRandValue = [$this->array[\array_rand($this->array)]];
            $this->array = $arrayRandValue;

            return $this;
        }

        /** @noinspection NonSecureShuffleUsageInspection */
        \shuffle($this->array);

        return $this->firstsMutable($number);
    }
291234
def shuffle(seed=nil)
      seed ||= Random.new_seed

      new_rdd_from_command(Spark::Command::Shuffle, seed)
    end