[Question]
  [
Given a list of positive integers that contains at least 3 distinct entries, output a permutation of that list that isn't sorted in ascending or descending order.
### Examples
```
1,2,3 -> 2,1,3 or 3,1,2 or 1,3,2 or 2,3,1
1,2,3,3 -> 2,1,3,3 or 3,1,2,3 or 1,3,2,3 etc..
```
Thanks @Arnauld and @NoOneIsHere for the title!
  
[Answer]
# JavaScript (ES6), ~~39~~ 34 bytes
```
a=>[a.sort((x,y)=>x-y).pop(),...a]
```
Sort the array in ascending order, pop the last element and use it as the first element of a new array. Then destructure the remaining elements of the original array into the new array (In JS, both `sort` and `pop` modify the original array).
---
## Test it
```
o.innerText=(f=
a=>[a.sort((x,y)=>x-y).pop(),...a]
)(i.value=[1,2,3]);oninput=_=>o.innerText=f(i.value.split`,`)
```
```
<input id=i><pre id=o>
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 2 bytes
```
o↻
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/P/9R2@7//6MNdYx0jHWMY//7AwA "Brachylog – Try It Online")
or
```
o↺
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/P/9R267//6MNdYx0jHWMY//7AwA "Brachylog – Try It Online")
Sorts then rotates the list
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
Ṣṙ1
```
[Try it online!](https://tio.run/##y0rNyan8///hzkUPd840/P//f7ShjoKRjoJxLAA "Jelly – Try It Online")
[Answer]
# [Ohm](https://github.com/MiningPotatoes/Ohm), 2 bytes
```
S╙
```
[Try it online!](https://tio.run/##y8/I/f8/@NHUmf//RxvqKBjpKBjHAgA "Ohm – Try It Online")
Sort and rotate to the right.
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), 3 bytes
```
n é
```
[Test it](http://ethproductions.github.io/japt/?v=2.0a0&code=biDp&input=WzIsMSwzXQ==)
Sorts (`n`) the array and rotates it (`é`) one element to the right.
[Answer]
# [Python 3](https://docs.python.org/3/), 31 bytes
```
lambda a:sorted(a)[1:]+[min(a)]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHRqji/qCQ1RSNRM9rQKlY7OjczD8iO/V9QlJlXopGmEW2oY6RjrGOiYxqrqfkfAA "Python 3 – Try It Online")
-1 byte thanks to xnor
[Answer]
# APL, 9 bytes
```
{1⌽⍵[⍋⍵]}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT/8PBNWGj3r2PurdGv2otxtIxdYqGCoYKRgrGHNhypgAxS0UTBXMwSosgXxTIMsSyDZSMAEA)
**How?**
`⍵[⍋⍵]` - sort the list
`1⌽` - rotate by 1
[Answer]
# TI-Basic (TI-84 Plus CE), 31 bytes
```
Prompt A
SortA(LA
max(LA→B
dim(LA)-1→dim(LA
augment({B},LA
```
Prompts for input in the format `{1,2,3,4}`.
TI-Basic is a [tokenized language](http://tibasicdev.wikidot.com/one-byte-tokens), all tokens used here are one-byte.
Explanation:
```
Prompt A         # 3 bytes, store user input in LA
SortA(LA         # 4 bytes, sort LA ascending
max(LA→B         # 6 bytes, save the last value in the sorted list to B
dim(LA)-1→dim(LA # 11 bytes, remove the last value from LA
augment({B},LA   # 7 bytes, prepend B to LA and implicitly print the result
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~7~~ ~~5~~ 4 bytes
```
.P1S
```
[Try it online!](https://tio.run/##K6gsyfj/Xy/AMPj//2hDHQUjHQXjWAA "Pyth – Try It Online")
*-1 byte thanks to FryAmTheEggman*
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
{Á
```
[Try it online!](https://tio.run/##MzBNTDJM/f@/@nDj///RhjogaKRjomMcCwA "05AB1E – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
{À
```
[Try it online!](https://tio.run/##MzBNTDJM/f@/@nDD///RRjoKJjoKxjoKpjoKhjoKRmC2SSwA "05AB1E – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina), 21 bytes
```
O#`
s`(.*)¶(.*)
$2¶$1
```
[Try it online!](https://tio.run/##K0otycxL/P/fXzmBqzhBQ09L89A2EMmlYnRom4rh///GXMZcRlyGAA "Retina – Try It Online") Sort and rotate as per usual. At least there's no unary conversion this time.
[Answer]
# Java 8, ~~68~~ 37 bytes
```
l->{l.sort(null);l.add(l.remove(0));}
```
-31 bytes thanks to *@Nevay* (forgot Java 8 had a `List#sort(Comparator)` method..)
Modifies the input-`ArrayList`, instead of returning a new one.
**Explanation:**
[Try it here.](https://tio.run/##nU7LasMwELz7K@Yol1jp42hS6L0NhRxLDxtZaeXKkpHWLib4213ZDjTHUlgtzKzmUVNPhW@1q6uvyTStD4w6cbJjY@VNCWC7xSsl2p/AnxrHgXWhfOc4U5ZixAsZd84A41iHEymN/QyB3psKSjyFQMOziQybl0iXMb00kYmNwh4OO0y2eDxbGVO@cJ1NP62kqhJWBt34XovbPC/HqVylbXe0SXpxWHKa1EIcOBj38fYOytcKV9nz2sHp719yrRYlxQXdbe43DylmUTqpxKy5wMMQWTfSdyzblMHWXV//av4v@zEbpx8)
```
l->{                   // Method with ArrayList parameter and no return-type
  l.sort(null);        //  Sort the input-list (no need for a Comparator, thus null)
  l.add(l.remove(0));  //  Remove the first element, and add it last
}                      // End of method
```
[Answer]
# Haskell, ~~36~~ 37 bytes
```
import Data.List
f(a:b)=b++[a];f.sort
```
~~Use view patterns to match on the head of a sorted version of the input list, then append the first item of the list to the tail of the remaining list.~~
View patterns aren't worth it. Sort the list, take the head off, append it to the end. In this case, it turns out that the naive solution typed out compactly is the best.
[Answer]
# [Perl 6](https://perl6.org), ~~43~~ 19 bytes
```
{first {![<=]($_)&&![>=] $_},.permutations}
```
[Try it](https://tio.run/##K0gtyjH7X1qcqlBmppdszZVbqaCWl1@iW5xfVKJg@786LbOouEShWjHaxjZWQyVeU01NMdrONlZBJb5WR68gtSi3tCSxJDM/r7j2f3FipQJcq4ahjpGOseZ/AA "Perl 6 – Try It Online")
```
*.sort[1..*,0].flat
```
[Try it](https://tio.run/##K0gtyjH7X1qcqlBmppdszZVbqaCWl1@iW5xfVKJg@19LD8SINtTT09IxiNVLy0ks@W/NVZxYqQBXpGGoY6RjrPkfAA "Perl 6 – Try It Online")
Note that `[1..*,0]` would result in `((2,3),1)`, so `.flat` is there to turn it into `(2,3,1)`
[Answer]
# Mathematica, 18 bytes
```
RotateLeft@Sort@#&
```
[Try it online!](https://tio.run/##y00sychMLv6fZvs/KL8ksSTVJzWtxCE4v6jEQVntf0BRZl6JgkNadLWhjpGOcW3sfwA "Mathics – Try It Online")
[Answer]
# [Ly](https://esolangs.org/wiki/Ly), 7 bytes
```
&nasprl
```
[Try it online!](https://tio.run/##y6n8/18tL7G4oCjn/39DBWMIBAA "Ly – Try It Online")
Ugh, ruining the sort is so expensive!
Explanation:
```
&nasprl
&n      # take input as a list of numbers
  a     # sort
   sp   # save top of stack and pop
     r  # reverse stack
      l # load saved item
```
[Answer]
# R, ~~33~~ ~~32~~ 29 bytes
Takes input from stdin. Sorts the list and then moves the first element to the end, ensuring that it is no longer sorted. Saved three bytes due to Giuseppe.
```
c(sort(x<-scan())[-1],min(x))
```
Another implementation, same byte count:
```
c((x<-sort(scan()))[-1],x[1])
```
[Answer]
# [Ohm](https://github.com/MiningPotatoes/Ohm), 2 bytes
```
S╜
```
[Try it online!](https://tio.run/##y8/I/f8/@NHUOf//RxvqKBjpKBjHAgA "Ohm – Try It Online")
I think this is dissimilar enough from totallyhuman's post to post a new answer; I hope you don't mind :P **EDIT**: DAMMIT YOU NINJA'D ME
[Answer]
# Python, 31 bytes
```
def f(a):a[1:]=a[a.sort():0:-1]
```
Yet another Python solution.
Sadly, this one has the same length to [HyperNeutrino's answer](https://codegolf.stackexchange.com/a/138846/44718).
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 3 bytes
```
ȯ1«
```
[Try it online!](https://tio.run/##S0/MTPz//8R6w0Or/6c@apv4P9pIwVDBOBYA "Gaia – Try It Online")
Same as other answers: sort `ȯ` and rotate left once `1«`.
[Answer]
# [Retina](https://github.com/m-ender/retina), 10 bytes
```
O#`
O^#-2`
```
[Try it online!](https://tio.run/##K0otycxL/P/fXzmByz9OWdco4f9/Yy5jLiMuQwA "Retina – Try It Online")
```
O#`     Sort the list
O^#-2`  Reverse sort the list other than the last element
```
This leaves the list with the 2nd highest element first and the highest element last which is never correctly sorted
[Answer]
# Ruby, 18 bytes
Submitted on mobile. Please don't kill me for problems. 
```
->a{a.sort.rotate}
```
[Answer]
# Pyth, 5 bytes
```
.>SQ1
```
# Explanation
`SQ` - sort input list
`.>SQ1` - rotate input list cyclicaly by 1
[Answer]
# [Proton](https://github.com/alexander-liao/proton), 19 bytes
```
a=>sorted(a)[1to,0]
```
[Try it online!](https://tio.run/##KyjKL8nP@@@QZvs/0dauOL@oJDVFI1Ez2rAkX8cg9n9BUWZeiUaaRrShjoKRjoKpjoKJjoJxrKbmfwA "Proton – Try It Online")
-2 bytes indirectly thanks to xnor
~~Not yet working on TIO; waiting for a pull.~~
[Answer]
# [Python 3](https://docs.python.org/3/), 28 bytes
```
lambda a:a[1:a.sort()]+a[:1]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHRKjHa0CpRrzi/qERDM1Y7MdrKMPZ/QVFmXolGmka0sY6RjqGOSaym5n8A "Python 3 – Try It Online")
`a.sort()` sorts `a` in place and returns `None`. `None` can be used as a slicing index and is the same as omitting that index.
[Answer]
# [Python 3](https://docs.python.org/3/), 31 bytes
```
lambda a:a.sort()or[a.pop(),*a]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHRKlGvOL@oREMzvyg6Ua8gv0BDU0crMfZ/QVFmXolGmka0oY6RjqmOsY5JrKbmfwA "Python 3 – Try It Online") or [Verify all test cases.](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHRKlGvOL@oREMzvyg6Ua8gv0BDU0crMfZ/QVFmXomGeppGtKGOkY5xrKaCra26jgKCr8mFpgRTEVjZfwA "Python 3 – Try It Online")
Inspired by Shaggy's [JS answer](https://codegolf.stackexchange.com/a/138858/66459). 
[Answer]
# [RProgN 2](https://github.com/TehFlaminTaco/RProgN-2), 2 bytes
```
§›
```
[Try it online!](https://tio.run/##Kyooyk/P0zX6r2GoYKpgrGCkYKj5/9DyRw27/v8HAA "RProgN 2 – Try It Online")
[Answer]
# PHP, 44 bytes
requires PHP 5.4 or later for short array syntax.
```
sort($a=&$argv);print_r([array_pop($a)]+$a);
```
sort arguments, replace 0-th argument with removed last argument, print.  
Run with `-nr` or [try it online](http://sandbox.onlinephpfunctions.com/code/61de8dc832ad8353be98057afb38130261abb47a).
---
The 0-th argument is the script file name, `"-"` if you call PHP with `-r`. `"-"` is compared to the other arguments as a string, and since `ord("-")==45`, it is smaller than any number. The numbers themselves, although strings, are compared as numbers: `"12" > "2"`.
`php -nr '<code>' 3 4 2 5 1` and `sort($a=&$argv)` lead to `$a=["-","1","2","3","4","5"]` →  
`[array_pop($a)]+$a` is `[0=>"5"]+[0=>"-",1=>"1",2=>"2",3=>"3",4=>"4"]`,  
which results in `[0=>"5",1=>"1",2=>"2",3=>"3",4=>"4"]`.
[Answer]
# Julia, 23 bytes
```
f(x)=sort(x)[[2:end;1]]
```
Slightly shorter than, but equivalent to `f(x)=circshift(sort(x),1)`.
I wish I could makeamethod based on `select` that was more, compact but I can not
]