-1

I want to select some random set of grouped items from permutation list. How to do it in a single function call or maybe with minimal code. For Eg:

A=[1,2,3]

If I input list A and a requirement (say 2) means, from all possible permutations

[1,2,3], [1,3,2], [3,1,2], [3,2,1],[2,1,3],[2,3,1]

I have to get randomly two list. Should return : [3,1,2],[2,1,3] or any other random two lists/tuple

Vishnu Vardhan
  • 47
  • 1
  • 1
  • 6
  • Does this answer your question? [Random picks from permutation generator?](https://stackoverflow.com/questions/5602488/random-picks-from-permutation-generator) – Joe Apr 16 '20 at 16:24

1 Answers1

1

You could use numpy random permutation.

random_arr_func = lambda x:[list(np.random.permutation(your_list)) for i in range(2)]
list(b(your_list))
Anurag Reddy
  • 1,159
  • 11
  • 19