[Question]
  [
## **Concept**
In what ways can you scramble the English alphabet so that it can still be sung to the tune Twinkle Twinkle Little Star without ruining the tune?
## **Rules**
**Swapping** 
Let's just assume the letters contained in each of the following sets can be swapped freely by default without ruining the tune:
* { A, J, K }
* { B, C, D, E, G, P, T, V, Z }
* { I, Y }
* { Q, U }
* { S, X, F }
* { M, N }
* Therefore H, L, O, R, and W are locked in place
**Output**
The program needs to output a single RANDOM string (or list of characters) containing the complete English alphabet in any order provided that order satisfies the conditions above. There should be no way for you to predict which string your program will output(if we ignore seeding), meaning you can't just hardcode it.
Your program must have some positive probability (not necessarily uniform) of generating each of the \$ 9! \cdot 3! \cdot 3! \cdot 2! \cdot 2! \cdot 2! = 104509440 \$ outputs.
There are no particular formatting restrictions regarding spacing, delimiters or case, just be consistent.
**Goal**
Fewest bytes wins!
## **Examples:**
* KCDBPSVHIAJLMNOZQRXGUEWFYT
* A,G,Z,V,P,X,C,H,Y,K,J,L,N,M,O,T,U,R,S,D,Q,B,W,F,I,E
* KVTDCFBHIJALNMOPURSZQGWXYE
* j c d e b x t h i k a l n m o g u r s v q p w f y z
* ABCDEFGHIJKLMNOPQRSTUVWXYZ
## **Nonexample:**
* HLWROABCDEFZXYGIJKMNPQTSVU
## **Proof of Concept: (Python3, 529 bytes)**
```
import random
g1 = ['A', 'J', 'K']
g2 = ['B', 'C', 'D', 'E', 'G', 'P', 'T', 'V', 'Z']
g3 = ['I', 'Y']
g4 = ['Q', 'U']
g5 = ['S', 'X', 'F']
g6 = ['M', 'N']
random.shuffle(g1)
random.shuffle(g2)
random.shuffle(g3)
random.shuffle(g4)
random.shuffle(g5)
random.shuffle(g6)
print(g1[0] + g2[0] + g2[1] + g2[2] + g2[3] + g5[0] + g2[4] + 'H' + g3[0] + g1[1] + g1[2] + 'L' + g6[0] + g6[1] + 'O' + g2[5] + g4[0] + 'R' + g5[1] + g2[6] + g4[1] + g2[7] + 'W' + g5[2] + g3[1] + g2[8])
```
  
[Answer]
# [Python 3](https://docs.python.org/3/), ~~140~~ ~~133~~ ~~124~~ 123 bytes
```
d=*map(set,'AJK BCDEGPTVZ IY QU SXF MN H L O R W'.split()),
print([d[int(c,16)].pop()for c in'0111141620075581394131a421'])
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P8VWKzexQKM4tURH3dHLW8HJ2cXVPSAkLErBM1IhMFQhOMJNwddPwUPBR8FfIUghXF2vuCAns0RDU1OHq6AoM69EIzolGkQl6xiaacbqFeQXaGim5RcpJCtk5qkbGAKBiaGZkYGBuamphaGxpYmhsWGiiZGheqzm//8A "Python 3 – Try It Online")
-1 byte, thanks to Jo King
---
# [Python 2](https://docs.python.org/2/), ~~174~~ ~~170~~ 158 bytes
```
from random import*
s=''
for c in'abbbbebHcaaLffObdRebdbWecb':s+=choice(list(set(('AJK BCDEGPTVZ IY QU SXF MN '+c).split()['abcdef'.find(c)])-set(s)))
print s
```
[Try it online!](https://tio.run/##Fcy7DsIgFIDhvU9xNkBjB0eTDt7v97vGAQ6QkrTQAItPj/Vf/u1rvrF0tp@S9q4Gz61sZ@rG@djJQkFIpp0HBGMJF21KLJDzjdZ7IU9KSHFXKMggdAssnUFFKxMiDSpSSoarNYzGk@n8cLm9YPmE4xXOjxlsd0C6yPLQVCZS9m5llEqTXBsrKbIP6/2BwBjLGm9shJDSDw "Python 2 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 28 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
A.•¬=©ƶÓÄûkTVã”ØζÞ•Dás#€.rJ‡
```
Outputs as a single lowercase string.
[Try it online](https://tio.run/##ATsAxP9vc2FiaWX//0Eu4oCiwqw9wqnGtsOTw4TDu2tUVsOj4oCdw5jOtsOe4oCiRMOhcyPigqwuckrigKH//w) or [verify \$n\$ random outputs at once](https://tio.run/##AT8AwP9vc2FiaWX/Rv9BLuKAosKsPcKpxrbDk8OEw7trVFbDo@KAncOYzrbDnuKAokTDoXMj4oKsLnJK4oCh/yz/MTA).
**Explanation:**
```
A                    # (a) Push the lowercase alphabet
 .•¬=©ƶÓÄûkTVã”ØζÞ•  # Push compressed string "ajk bcdegptvz iy qu sxf mn"
  Dá                 # (b) Duplicate it, and only keep the letters (removing the spaces)
    s#               # Swap to get the string again, and split it by spaces
      €.r            # Shuffle each substring randomly
         J           # (c) Join it back together to a single string
          ‡          # Transliterate all characters from (b) to (c) in string (a)
                     # (and output the result implicitly)
```
[See this 05AB1E tip of mine (section *How to compress strings not part of the dictionary?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `.•¬=©ƶÓÄûkTVã”ØζÞ•` is `"ajk bcdegptvz iy qu sxf mn"`.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 102 bytes
```
s=[*?A..?Z]*''
%w(AJK BCDEGPTVZ IY QU SXF MN).map{|e|a=e.chars.shuffle;s.gsub!(/[#{e}]/){a.pop}}
$><<s
```
[Try it online!](https://tio.run/##KypNqvz/v9g2WsveUU/PPipWS12dS7Vcw9HLW8HJ2cXVPSAkLErBM1IhMFQhOMJNwddPUy83saC6JrUm0TZVLzkjsahYrzijNC0tJ9W6WC@9uDRJUUM/Wrk6tTZWX7M6Ua8gv6C2lkvFzsam@P9/AA "Ruby – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~59~~ ~~57~~ 56 bytes
```
hMeD,Vs.SMJc"ajk bcdegptvz iy qu fsx mn h l o r w"dxLGsJ
```
[Try it online!](https://tio.run/##K6gsyfj/vzjDN9VFJ6w4Vy84xStZKTErWyEpOSU1vaCkrEohs1KhsFQhrbhCITdPIUMhRyFfoUihXCklt8I9pdjr/38A "Pyth – Try It Online")
Output is an array of lower case letters.
```
hMeD,Vs.SMJc"ajk bcdegptvz iy qu fsx mn h l o r w"dxLGsJ   Implicit: d=" ", G=<lowercase alphabet>
          Jc"ajk bcdegptvz iy qu fsx mn h l o r w"d        Chop the grouping string on spaces, store in J
                                                      sJ   Concatenate J into single string
                                                   xLG     Find the index of each letter in grouping string in the unaltered alphabet
       .SMJ                                                Shuffle each group in J
      s                                                    Concatenate into a single string
    ,V                                                     Pair the shuffled string with their 'correct' positions in the alphabet
  eD                                                       Order the pairs by the derived positions (last element of each pair)
hM                                                         Keep the letter from each pair (the first element)
                                                           Implicit print
```
[Answer]
# [R](https://www.r-project.org/), ~~93~~ 91 bytes
```
`^`=strsplit
L=LETTERS
for(s in el('AJK7BCDEGPTVZ7IY7QU7FSX7MN'^7)^'')L[L%in%s]=sample(s)
L
```
[Try it online!](https://tio.run/##XVBda8IwFH2/v@LC0CTgnvuyMqZWUetnU1GHosQUwzqVJmODsd/e5daOjeXhJCf33JuTU5TlfrcPrSvsNTcO4jCOpIwWCWSXgls0Z9Q5Z0/DUdDudKP@TC43wWAdzNOgl6yC8YTtArFjTMTPccOcG3Yb2sPrNdfcCojLO1QnrV7QZBijsaguRaGVA7DaWXy4x9xYx0H5F1gL2ZBgxESLbtpEOgRdgoigTzAjkARLgk2tHxBZ12ROJK1Jj0hCsKpvxkQmTICAzHzoI1nxlo4my3gdQOvtXJkjp0IAGDsdkUwu0ugWjnYUT1X/BMRKEN62ZhMPec7tpXD8/WTU6WcqUkjUIzAM8W/9t@IXfMG/cT7fm6Lyu6Xu6gSgDs5/PsFpKmepRC9/RP89ahRQfgM "R – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 76 bytes
```
{my@a='A'..'Z';<AJK BCDEGPTVZ IY QU SXF MN>>>.&{@a[.ords X-65].=pick(*)};@a}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwvzq30iHRVt1RXU9PPUrd2sbRy1vBydnF1T0gJCxKwTNSITBUITjCTcHXz87OTk@t2iExWi@/KKVYIULXzDRWz7YgMzlbQ0uz1tohsfZ/cWKlQpqGpvV/AA "Perl 6 – Try It Online")
Anonymous code block taking no arguments and returning a list of characters.
### Explanation:
```
{                                                                          } # Anonymous code block
 my@a='A'..'Z';      # Initialise @a as a list of the alphabet
               <AJK BCDEGPTVZ IY QU SXF MN>   # For each of the sets of letters
                                           >>.&{@a[.ords X-65].=       }  # Set those indexes
                                                                pick(*)   # To a random order
                                                                        ;@a  # And return
```
[Answer]
# JavaScript - ~~421~~ ~~344~~ ~~328~~ ~~320~~ ~~306~~ ~~280~~ ~~277~~ ~~276~~ ... 176 Bytes
-77 Bytes - on my own   
  
-18 Byte - thanks to [@tsh](https://codegolf.stackexchange.com/users/44718/tsh) and [@Geza Kerecsenyi](https://codegolf.stackexchange.com/users/85546/geza-kerecsenyi) who made me see what [@tsh](https://codegolf.stackexchange.com/users/44718/tsh) initially pointed out too   
  
-8 Bytes - thanks to [@Geza Kerecsenyi](https://codegolf.stackexchange.com/users/85546/geza-kerecsenyi)   
  
-14 Bytes - with help of [@Geza Kerecsenyi](https://codegolf.stackexchange.com/users/85546/geza-kerecsenyi)   
  
-28 Bytes - on my own   
  
-3 Bytes - again with with help of [@Geza Kerecsenyi](https://codegolf.stackexchange.com/users/85546/geza-kerecsenyi)   
  
-1 Bytes - how could this happen...   
  
**...**   
  
-100 Bytes - [@Kaiido](https://codegolf.stackexchange.com/users/64489/kaiido) killed it and via some steps before this whole thing got down to [176 Bytes](https://codegolf.stackexchange.com/questions/188106/do-you-know-your-kvzs/188119#comment450793_188119)  
  
### Golfed:
```
c=[,'AJK','BCDEGPTVZ','IY','QU','SXF','MN'].map(s=>[...s]);alert([...'1222252H311L66O24R5242W532'].reduce((o,v)=>o+(+v?(p=>p.splice((Math.random()*p.length)|0,1))(c[v]):v),""))
```
or [try it online](https://tio.run/##FYvZDoIwFET/hZf2Sm1CEWM0YNxX3HfCQ1OJYhSagv19rPNwMieTeXHNC6FSWdZ1q6qEHxHUmy8QQf3BcDTZHE4302dXg@3RYH8ZG4YrFNMPl7jwg4hSWsTQkSrNSvw35DATj01dx1k2m2vW2Hmswc6ey8xNJfevSDDOiQY/yG1s6y6WfiBpId/pfwl5@aSKZ/f8g6Em6TvJHuUTiAOARaRjaGsglgVQVT8)!
[Answer]
# [Runic Enchantments](https://github.com/Draco18s/RunicEnchantments/tree/Console), 210 bytes
```
>yy `AJK`06B$̤$@
>`BCDEGPTVZ`06B$$$$ $̤$y $ $y @
>̤`IY`06Byyy$yyy̤ @
> ̤`QU`06Byy̤ $y @
> ̤`FSX`06B $yy̤$yy@
>y̤ `MN`06Byyy $@
}}f}l3-[r\
3-[2'RA?rR1Kl'RAs]{1-:0)?\}l
> ̤`HLORW`06Bo$y $y$y$yy@ \~{{B͍
```
[Try it online!](https://tio.run/##KyrNy0z@/9@uslIhwdHLO8HAzEnlzBIVBy67BCdnF1f3gJCwKLAgECiAZCoVgHSlAlDBmSUJnpEgucrKShUgPrMEJKoAFA4MhQgDRSBKQYJuwREgUaBIJciYSqAwSEGCrx/UDAWgrbW1abU5xrrRRTFcQNJIPcjRvijI0DsHyCiOrTbUtTLQtI@pzYGY6OHjHxQO0pwPclUlCFY6KMTUVVc7ne39/x8A "Runic Enchantments – Try It Online")
The randomization is *not uniform* as there isn't a good way to do that in Runic. Instead it randomly rotates each collection of letters (e.g. `[BCDEGPTVZ]` is one grouping) by some amount (e.g. rotating the above set by 4, where the top of the stack is at the right, the result would be `[BCDEGZPTV]`) and then randomly decides whether or not to reverse the stack. It performs these operations 15 times. As a result, all possible orderings are *possible* but not *equally likely.* (In the event that this is not enough, increasing it further [costs zero bytes](https://tio.run/##KyrNy0z@/9@uslIhwdHLO8HAzEnlzBIVBy67BCdnF1f3gJCwKLAgECiAZCoVgHSlAlDBmSUJnpEgucrKShUgPrMEJKoAFA4MhQgDRSBKQYJuwREgUaBIJciYSqAwSEGCrx/UDAWgrbW1aRG1Oca60UUxXLrRRupBjvZFht5BOUBGcWy1oa6VgaZ9DFABxEgPH/@gcJDufJCzKkGw0iGmrrra6Wzv//8A), up to 15000 shuffle loops).
This is the section of the code that handles the shuffling:
```
  v              vvvv           Loop counter
}}f}l3-[r\                      < Loop entry
[2'RA?r1KRl'RAs]{1-:0)?\}l3-
                       \~{{B͍    < loop exit
 ^^^^^^                         Randomly reverse
          ^^^^^                 Rotate by a random an amount
```
The rest of the code unrolls into this:
```
                     ABCDEFGHIJKLMNOPQRSTUVWXYZ
>      `AJK`08B      $        $$;
> `BCDEGPTVZ`08B $$$$ $ $ $ $ $;
> `IY`08B $ $;
> `QU`08B $ $;
> `FSX`08B $ $ $;
> `MN`08B $$;
>          `HLORW`08Bo      $   $  $  $    $;
^                                                   Create IPs
 ^^^^^^^^^^^^^^^^                                   Set letter groupings
                  ^^^                               Call shuffle function
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^    Print letters
                     ^                              Last letter group needs to be sorted
```
If the letters are left unshuffled (but once-reversed) by changing two bytes the alphabet [is printed normally](https://tio.run/##KyrNy0z@/18BF3B0cnZxdXP38PTy9vH18w8IDAoOCQ0Lj4iM4gJJ20FUJTh6eScYWDhBeCowzSoq1lBVCSBj3ANCwqKQlAEBklowBpPWyEaDTPeMROhCswLGR9ejkBAYiq4J2SZM9W7BEUgaVDBsw9QC1OTrh2GJChazPXz8g8JBKvORPQtFYKNra81qc4x1o4tiUAzTr6uudjrbyxVtpB7kaK9g6B2UA2TUxVYb6loZaNrrg/T8/w8A), which can be used to verify that all letter groupings print in the correct places. The whitespace shifting the `B` commands out of phase is so that all the IPs can use the function loop at the same time without colliding, and then getting them back into phase again.
To golf, first any space that could be removed on all lines was trimmed, then each two spaces were converted to a `y`, and every sequence of `yyyy` was converted to `̤` because `̤` and `yyyy` are the same amount of delay, but 2 bytes cheaper. The loop exit was also combined with the `HLORW` main program segment in order to save on the spacing bytes (12 bytes).
[Answer]
# [Perl 5](https://www.perl.org/), ~~103 91~~ 85 bytes
```
map{my%l;@l{/./g}++;@k{/./g}=keys%l}AJK,BCDEGPTVZ,SXF,IY,QU,MN;say map$k{$_}||$_,A..Z
```
[Try it online!](https://tio.run/##K0gtyjH9/z83saA6t1I1x9ohp1pfTz@9Vlvb2iEbwrTNTq0sVs2pdfTy1nFydnF1DwgJi9IJjnDT8YzUCQzV8fWzLk6sVAAaoZJdrRJfW1OjEq/jqKcX9f//v/yCksz8vOL/ur6megaGBgA "Perl 5 – Try It Online")
This code (ab)uses the fact that Perl's output of hash keys (`%l`) is random to create a mapping (`%k`) of all the modifiable letters to one of their possible counterparts. At output time, any key that doesn't exist is assumed to be unchanged.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 34 bytes
```
ØA“wẸXWỵḲ⁻ȦƙṄṇ’œ?µ“ĠQ’ḃ3ÄœṖ⁸Ẋ€Ẏị@Ụ
```
[Try it online!](https://tio.run/##AVcAqP9qZWxsef//w5hB4oCcd@G6uFhX4bu14biy4oG7yKbGmeG5hOG5h@KAmcWTP8K14oCcxKBR4oCZ4biDM8OExZPhuZbigbjhuorigqzhuo7hu4tA4buk//8 "Jelly – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 149 bytes
```
a,b,i,q,s,m,h,l,o,r,w=(set(s)for s in["AJK","BCDEGPTVZ","IY","QU","SXF","MN",*"HLORW"])
print([eval(c).pop()for c in[*"abbbbsbhiaalmmobqrsbqbwsib"]])
```
[Try it online!](https://tio.run/##Hcy5DoMwEEXRPl@BprLRKE3qFNn3fQ@i8CAiLBlsbBSUr3ecvOLoVdd8mkJXPe8FEkqs0WGJBSrUaLHtM5c3zPGXtpGLZJXAYLkChOFoPJntz9dn@ItH4HAJnO7T4GYLGMN8vTveIOUdY2XVsCR/C8Uy3jXasH8u@@ViEBTmqJBCqLLUVFtHNbVOEqQp9/4L "Python 3 – Try It Online")
Randomization by using pop() for letter set
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 55 bytes
Full program. Prints uppercase with a leading and trailing space, but no intermediary spaces.
```
{(?⍨∘≢⊇⊢)@(∊∘⍺)⊢⍵}/⌈'AjkBcdegptvzIyQuSxfMn'(⊂⍤⊢,⍨∊⊂⊣)⎕A
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qKO94H@1hv2j3hWPOmY86lz0qKv9UdciTQeNRx1dIJHeXZpA/qPerbX6j3o61B2zsp2SU1LTC0rKqjwrA0uDK9J889Q1HnU1PepdAlSoAzaoC8TvWqz5qG@qI8iK/wUA "APL (Dyalog Extended) – Try It Online")
`⎕A` the uppercase alphabet
`'AjkBcdegptvzIyQuSxfMn'(`…`)` apply the following anonymous tacit function with that as right argument and the indicated string as left argument:
`⊣` for the left argument,
`⊂` partition it, beginning a new segment where
`∊` the left arguments characters are members of the right argument (i.e. on uppercase letters)
`,⍨` append
`⊂` enclose (to treat it as a single element)  
`⍤` the  
`⊢` right argument
`⌈` uppercase everything
`{`…`}/` reduce by the following anonymous lambda, giving …`"QU"λ("SXF"λ("MN"λ"A-Z"))`:
 `⊢⍵` on the right argument (the scrambling-in-progress alphabet)
 `(`…`)@(∊∘⍺)` apply the following anonymous tacit function to the subset that is a member of the left argument (a rhyme group)
  `⊢` on that subset
  `⊇` reorder it to be
  `?⍨` a random permutation  
  `∘` of length  
  `≢` tally of letters in the subset
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 43 bytes
```
ＦαＦ⪪”＆↖(vＪf#Ｓ»↖ιηa↷Ｎ↖⪪νＰ´↑x‖υ” Ｆ№κι‽Φκ¬№ＫＡμ
```
[Try it online!](https://tio.run/##LYtLDoIwGISvMumqTeoJXCGKb6zgC3cN1tjwQ01TvX4Fw2wm881M/dK@dppifDoPrgX@Xr7JBs6SzRazdL5YqtPljnWF4xnlLcM@xwo7HFDgyiQYmBiPqft0gTcStifK2z4Uunu4lmeWgvFDlbsw7pQxTULEhUQrBk1jjJMv/QA "Charcoal – Try It Online") Link is to verbose version of code. Charcoal has no shuffling operators, but I came up with a method of sampling without replacement. Explanation:
```
Ｆα
```
Loop over each letter of the alphabet.
```
Ｆ⪪”＆↖(vＪf#Ｓ»↖ιηa↷Ｎ↖⪪νＰ´↑x‖υ” 
```
Split the string `AJK BCDEGPTVZ IY QU SXF MN H L O R W` on spaces and loop over the substrings.
```
Ｆ№κι
```
Loop over the number of times the current letter appears in the substring. (I use a loop because a conditional would need an `else` caluse. Alternatively I could have filtered on the substring containing the current letter for the same byte count.)
```
‽Φκ¬№ＫＡμ
```
Print a random character but exclude ones that have already been printed.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 80 bytes
```
K`1A2B2C2D2E5F2GH3I1J1KL6M6NO2P4QR5S2T4U2VW5X3Y2Z
~(K`123456
.
?O`$&.¶
)`¶$
[blank line]
\d
[blank line]
```
[Try it online!](https://tio.run/##K0otycxLNPz/3zvB0NHIycjZyMXI1dTNyN3D2NPQy9Dbx8zXzM/fKMAkMMg02CjEJNQoLNw0wjjSKIqrTgOox8jYxNSMS4/L3j9BRU3v0DYuzYRD21S4uGJSNPQ0uVSABgMA "Retina – Try It Online")
Probably not the most golfed method, but I'll submit it anyway.
**Explanation:**
```
K`1A2B2C2D2E5F2GH3I1J1KL6M6NO2P4QR5S2T4U2VW5X3Y2Z
```
Set the working string to `1A2B2C2D2E5F2GH3I1J1KL6M6NO2P4QR5S2T4U2VW5X3Y2Z`. There is a number before each letter in a group, for example `A`, `J` and `K` all have `1` before them.
```
~(
```
Mark a section of code that will produce some retina code, then run it afterwards.
```
K`123456
```
Set the working string to `123456`
```
.
?O`$&.¶
```
Replace each character with `?O`{character}.¶`
```
)`¶$
[blank line]
```
Remove the trailing newline and finish the group to generate the code. The group will generate the code:
```
?O`1.
?O`2.
?O`3.
?O`4.
?O`5.
?O`6.
```
`{n}.` matches all instances of number *n* followed by a character. `?O` sorts each instance randomly, and this is done for all character sets.
```
\d
[blank line]
```
Finally, remove all numbers and implicitly output the generated string.
]