# Getting all possible combination of vector with all possible order

**URL:** <https://discourse.julialang.org/t/getting-all-possible-combination-of-vector-with-all-possible-order/879>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 12, 2016, 7:03am UTC](https://discourse.julialang.org/t/getting-all-possible-combination-of-vector-with-all-possible-order/879 "2016-12-12T07:03:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YongHee-Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yonghee-kim/32/5965_2.png) [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Post date:** [December 12, 2016, 7:03am UTC](https://discourse.julialang.org/t/getting-all-possible-combination-of-vector-with-all-possible-order/879/1 "2016-12-12T07:03:31Z")

</div>

I know that there is combination function whthin package ‘Combinatorics’  
which gives me all possible combination without regarding order of elements

```julia
x = combinations([1,2,3], 3)

# which gives this
collect(x) => [1,2,3]

# but I couldn't find function for getting this. 
=> [[1,2,3], [2,1,3], [3,1,2], [3,2,1]]

```

I looked up “Combinatorics” and “Iterators” Packages, but couldn’t find function I need.

thanks for your time.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [December 12, 2016, 9:18am UTC](https://discourse.julialang.org/t/getting-all-possible-combination-of-vector-with-all-possible-order/879/2 "2016-12-12T09:18:59Z")

</div>

Perhaps:

```julia
julia> x = permutations([1,2,3]) |> collect
6-element Array{Array{Int64,1},1}:
 [1,2,3]
 [1,3,2]
 [2,1,3]
 [2,3,1]
 [3,1,2]
 [3,2,1]

```

---

<div class="post-metadata">

**Author:** ![YongHee-Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yonghee-kim/32/5965_2.png) [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Post date:** [December 12, 2016, 11:35am UTC](https://discourse.julialang.org/t/getting-all-possible-combination-of-vector-with-all-possible-order/879/4 "2016-12-12T11:35:17Z")

</div>

That’s what I needed, thanks!
