Skip to main content
deleted 50 characters in body
Source Link
Maltysen
  • 25.8k
  • 4
  • 56
  • 128

Pyth, 2725 bytes

Test it here.

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XQN@QK XQKJXXQN@QKKJ)Q

Can probably be golfed further.Thanks to @Jakube for the swapping trick

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XQN@QK       Q[N]=Q[K]
 <space>      Suppress print
 XQKJ  XXQN@QKKJ    Swap K and Q[K]=JJ
)             End for
Q             Print Q

Pyth, 27 bytes

Test it here.

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XQN@QK XQKJ)Q

Can probably be golfed further.

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XQN@QK       Q[N]=Q[K]
 <space>      Suppress print
 XQKJ         Q[K]=J
)             End for
Q             Print Q

Pyth, 25 bytes

Test it here.

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XXQN@QKKJ)Q

Thanks to @Jakube for the swapping trick

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XXQN@QKKJ    Swap K and J
)             End for
Q             Print Q
make header work with leaderboard
Source Link
Martin Ender
  • 198.5k
  • 67
  • 455
  • 1k

Pyth, 27 bytes

#PythTest it here. - 27 bytes

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XQN@QK XQKJ)Q

Can probably be golfed further.

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XQN@QK       Q[N]=Q[K]
 <space>      Suppress print
 XQKJ         Q[K]=J
)             End for
Q             Print Q

#Pyth - 27 bytes

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XQN@QK XQKJ)Q

Can probably be golfed further.

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XQN@QK       Q[N]=Q[K]
 <space>      Suppress print
 XQKJ         Q[K]=J
)             End for
Q             Print Q

Pyth, 27 bytes

Test it here.

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XQN@QK XQKJ)Q

Can probably be golfed further.

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XQN@QK       Q[N]=Q[K]
 <space>      Suppress print
 XQKJ         Q[K]=J
)             End for
Q             Print Q
Source Link
Maltysen
  • 25.8k
  • 4
  • 56
  • 128

#Pyth - 27 bytes

Yet another Fisher-Yates implementation. Is essentially the same as @Sp3000 python solution, just in pyth.

FNrlQ1KONJ@QN XQN@QK XQKJ)Q

Can probably be golfed further.

<implicit>    Q=input()
FNrlQ1        For N in len(Q) to 1, only goes len Q-1 because how range implemented in pyth
 KON          K = random int 0-N
 J@QN         J=Q[N]
 <space>      Suppress print
 XQN@QK       Q[N]=Q[K]
 <space>      Suppress print
 XQKJ         Q[K]=J
)             End for
Q             Print Q