How does it rearrange the data elements ?Randomly or in some specific order?
Refer this https://www.geeksforgeeks.org/stdnext_permutation-prev_permutation-c/