# ANN: TupleShuffling: shuffling of tuples and generating random permutation tuples

**URL:** <https://discourse.julialang.org/t/ann-tupleshuffling-shuffling-of-tuples-and-generating-random-permutation-tuples/105506>\
**Category:** Package Announcements\
**Tags:** package, announcement, tuple, random, recursion\
**Created:** [October 28, 2023, 2:06pm UTC](https://discourse.julialang.org/t/ann-tupleshuffling-shuffling-of-tuples-and-generating-random-permutation-tuples/105506 "2023-10-28T14:06:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 28, 2023, 2:06pm UTC](https://discourse.julialang.org/t/ann-tupleshuffling-shuffling-of-tuples-and-generating-random-permutation-tuples/105506/1 "2023-10-28T14:06:12Z")

</div>

[TupleShuffling](https://gitlab.com/nsajko/TupleShuffling.jl) is [being](https://github.com/JuliaRegistries/General/pull/94293) registered. Use it when:

- There’s a tuple and you want to shuffle its elements. So like `shuffle` from the standard library, but for tuples instead of for arrays
- You want a random permutation of static size. So like `randperm` from the standard library, but for tuples instead of for arrays.

Suggestions welcome, v1.0.0 isn’t set in stone until the registration is over, in three days.

One thing I’m mulling over is whether to make some arguments optional, especially the RNG. Perhaps I could introduce `Random` as a dependency and make `Random.default_rng()` the default PRNG, but that function doesn’t seem to be public? What is the usual practice?

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [October 28, 2023, 4:37pm UTC](https://discourse.julialang.org/t/ann-tupleshuffling-shuffling-of-tuples-and-generating-random-permutation-tuples/105506/2 "2023-10-28T16:37:15Z")

</div>

Should this be a package or a PR?

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [October 28, 2023, 5:10pm UTC](https://discourse.julialang.org/t/ann-tupleshuffling-shuffling-of-tuples-and-generating-random-permutation-tuples/105506/3 "2023-10-28T17:10:57Z")

</div>

Can this be merged with [`TupleTools.jl`](https://www.google.com/url?q=https://github.com/Jutho/TupleTools.jl&sa=U&ved=2ahUKEwjzloL5nZmCAxWY_7sIHclLB6wQFnoECAoQAg&usg=AOvVaw0el-tvDXqudjXZcjtEJlNi), as they seem to have similar goals?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 28, 2023, 6:47pm UTC](https://discourse.julialang.org/t/ann-tupleshuffling-shuffling-of-tuples-and-generating-random-permutation-tuples/105506/4 "2023-10-28T18:47:11Z")

</div>

> [@tecosaur](#):
>
> Should this be a package or a PR?

You mean a PR onto Julia’s Base and/or Random? That could make sense, but it’s a separate issue that I’ll only get back to once I’m done with lots of other stuff, including other PRs onto Julia’s Base. I want this in a user package anyway because I want the functionality to be usable with a released version of Julia.

> [@jishnub](#):
>
> Can this be merged with [`TupleTools.jl`](https://www.google.com/url?q=https://github.com/Jutho/TupleTools.jl&sa=U&ved=2ahUKEwjzloL5nZmCAxWY_7sIHclLB6wQFnoECAoQAg&usg=AOvVaw0el-tvDXqudjXZcjtEJlNi), as they seem to have similar goals?

This is a separate issue, and one I don’t indent to work on unless the maintainer bumps the Julia compat to something more reasonable (they currently still support v1.0 as far as I understand). In any case it’s good to have self-contained functionality in separate packages in the interest of minimizing deps, compilation cost, etc. In fact, now I plan to split out one or two packages out from TupleShuffling into stand-alone packages before registering TupleShuffling.
