public static function sample($list, $n = 1)
    {
        return $n == 1
            ? static::get($list, static::keys($list)[static::random(static::size($list) -1)])
            : array_slice(static::shuffle($list), 0, $n);
    }
public static function sample($list, $n = 1)
    {
        return $n == 1
            ? static::get($list, static::keys($list)[static::random(static::size($list) -1)])
            : array_slice(static::shuffle($list), 0, $n);
    }
public static function sample ( $ list , $ n = 1 ) { return $ n == 1 ? static :: get ( $ list , static :: keys ( $ list ) [ static :: random ( static :: size ( $ list ) - 1 ) ] ) : array_slice ( static :: shuffle ( $ list ) , 0 , $ n ) ; }
Produce a random sample from the list. Pass a number to return n random elements from the list. Otherwise a
single random item will be returned.

@category Collection Functions

@param traversable $list the list of items
@param int $n optional, the number of items to pick

@return array
Produce a random sample from the list . Pass a number to return n random elements from the list . Otherwise a single random item will be returned .