[Question]
  [
Inspired by the upcoming winter bash event
### Objective
Add a hat `^`,`´` or ``` to a single vowel in each word of the input.
### Rules
* The `hat` and the `vowel` must be chosen at random. Each hat has to appear with the same probability (33%) and the vowels must have the same probability within the valid vowels in the word (if the word have 2 valid vowels each must be 50% likely to be chosen) - or the closest that your language has.
* Only `AEIOUaeiou`are considered vowels (sorry `y`)
* Vowels with hats in the input DO NOT interfere with the rules (you can consider it as a consonant)
* If the input has no vowel it won't be modified
* Capitalization must be preserved.
### Examples
`winter` > `wintér`  
`bash` > `bâsh`  
`rhythm` > `rhythm`  
`rng ftw` > `rng ftw`  
`cat in the hat` > `cât ìn thê hát`  
`dès` > `dès`  
`tschüss` > `tschüss`  
`principî` > `prìncipî`  
`PROGRAMMING PUZZLES & code golf` > `PROGRÂMMING PÚZZLES & codé gòlf`
### Winning
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the shortest code wins
  
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `S`, 17 bytes
```
⌈ƛAa[AT›℅3℅767+CṀ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJTIiwiIiwi4oyIxptBYVtBVOKAuuKEhTPihIU3NjcrQ+G5gCIsIiIsImhlbGxvLCB3b3JsZCEgcG90YXRvZXMgYXJlIGdyZWVuIFBQUFAiXQ==)
Some tricks stolen from [Seggan's answer](https://codegolf.stackexchange.com/a/248413/100664).
```
⌈ƛ                # Over each word
  Aa[             # If it has a vowel...
     A            # Is each a vowel?
      T           # Indices of vowels
       ℅›         # Choose a random one and increment it
         3℅       # Random choice from [1, 2, 3]
           767+   # Add 767
               C  # Make it a char
                Ṁ # Insert that at the specified index.
                  # (S flag) turn the word list into a sentence
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `S`, 27 bytes
```
⌈:ƛAT:[℅|u];Zƛ÷›[nt3℅767+CṀ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJTIiwiIiwi4oyIOsabQVQ6W+KEhXx1XTtaxpvDt+KAultudDPihIU3NjcrQ+G5gCIsIiIsIlBST0dSQU1NSU5HIFBVWlpMRVMgJiBjb2RlIGdvbGYiXQ==)
The result of my older answer mixed with [emanresu A's answer](https://codegolf.stackexchange.com/a/248465/107299).
# [Vyxal](https://github.com/Vyxal/Vyxal) `S`, ~~37~~ ~~35~~ 33 bytes
```
⌈:ƛ≬k∨$cḟ:[℅|u];Zƛ÷›:[768:⇧ṡC℅Ṁ|_
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJTIiwiIiwi4oyIOsab4omsa+KIqCRj4bifOlvihIV8dV07Wsabw7figLo6Wzc2ODrih6fhuaFD4oSF4bmAfF8iLCIiLCJQUk9HUkFNTUlORyBQVVpaTEVTICYgY29kZSBnb2xmIl0=)
-2 bytes thanks to @Steffan
-2 bytes by inlining the register
I manually generated the diacritics list so this wouldn't have to be scored in UTF-8.
```
⌈:ƛ≬k∨$cḟ:[℅|u];Zƛ÷›:[768:⇧ṡC℅Ṁ|_ # 'S' flag joins the output on spaces
⌈                                  # Split the input on spaces
 :                                 # Duplicate
  ƛ            ;                   # Map the duplicate to...
   ≬    ḟ                          # Find the indexes in the word that satisfy the following condition:
      $c                           # Is the character contained in...
    k∨                             # "aeiouAEIOU"?
         :[   ]                    # If the list is not empty (i.e. the word has vowels)
           ℅                       # Choose a random index from the list
            |                      # Otherwise...
             u                     # Push -1
                Z                  # Zip the mapped list and the word list together
                 ƛ                 # Map the new list of pairs of words and indexes
                  ÷                # Push the word, then the index
                   ›               # Increment the index (0 becomes 1, -1 becomes 0)
                    :[             # If the index is not 0 (i.e. if there is a vowel)
                      768          # Push the charcode of the first diacritic
                         :         # Duplicate
                          ⇧        # Add 2
                           ṡ       # Inclusive range from 768 - 770
                            C      # Unicode value -> character for each number
                              ℅    # Choose a random diacritic
                               Ṁ   # And insert it before the vowel
                                |  # Otherwise...
                                 _ # Pop the duplicated index, leaving the word on the stack
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 118 bytes
Spec doesn't state what [Unicode normalisation](https://en.wikipedia.org/wiki/Unicode_equivalence#Normal_forms) is allowed. Examples use NFC, but NFD is cheaper.
```
s=>s.replace(/\S+/g,w=>w.replace(x=/[aeiou]/gi,c=>v--?c:c+'̀́̂'[3*r()|0],v=(r=Math.random)()*w.match(x)?.length|0))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=ZVLPb9MwGJU4-q_widhrm4RfAq0k1YTKNImu06Zd1lZa6jpxIE0i22k7tkljJw6cuAGXUoG0oYnDbkjcfO0_AH8NdtMWJE7vvU_f8_s-25--pNmATmeh97WQYe3Jr5HwfGFzmicBocjpHlScqDr2_PG6NvGcTkDjrOg5UVwlnj-q1Rpkk1Ss-cX8zfzS6jzY4Aifub3qyEPcawWS2TxIB9kQI7wxtoeBJAxNcMNOaBpJduZiXKb_vlPUATgGW9CH6gI0DbwFOwbegbaB9-DQwAcQGJgCauAKxAZuQGbgFhQGfoBxnErKNTdEXXPQDwTTsq9mggHOTiQbalkSwNMIhnJsCiUDA3UltDQApCBM_RRGryjIeZySOFffdTHn6qYUgAQSximUjEKmqQ-Jmkk9nSmpb5CpzxLs7be397darZ3dbbh3eHT0onkA70KinwJGWRJq06JDXS5b1Md_etQ1jNRtEoJjW_J4iLAt8iSWyOqmFrbDjDcDfb-SCgk9H54CqE2pFp2qnisvZBXSSU6J7EEPmq7lgzjIrmCdbMDB9bWNU1EkUujm03NT1QEQJVQvqUtuXcNTeM91DavoA5btnRAtwrCdZnwYJPFriqzd588svIjlBf2bkAfCHL9yltP971sZsoTaSRahha0BrW5x_7H7yIKbJX1IrPWiVs3Xot1_aQ58RU8EWoboO8u4RFjveY7r5e-bTkv8Aw) Note: My test does 1000 trials and checks to see if it got the example output. Occasionally it misses for the long ones.
This is basically the same as the old solution, just swapped out the vowel replacement function.
# Old solution (NFC), 159 bytes
```
s=>s.replace(/\S+/g,w=>w.replace(x=/[aeiou]/gi,c=>v--?c:Buffer(c+c).map((n,j)=>j?n+68-4*!(n&12)-!(n&16)+3*r()|0:195),v=(r=Math.random)()*w.match(x)?.length|0))
```
[Attempt This Online 2!](https://ato.pxeger.com/run?1=TZJNTxNBGMcTj_MpxgudabvbFgGxdbeBpCEk1hIaLrQkbIfZF9zubmZmaQmQGE8ePHlTD9ZGEzDEAzcTb_Mp9NP4TLegp9__efb_vMzMfvqapCd8Nvedb7nyrc3fn6XjSlvwLPYYJ7Vhv1ILqhPHnTzkpk5t4PEozY9qQVRljntmWW3W3M59nwvCKozaYy8jJKmeUsc9bSeVjU1rrfyYJCuNVWotuEErT8qC0Mt6s_FsnVbPHCKcrqdCW3jJSTqmhJYn0EaxkExp2455Eqjwsk5pseafR_0WQsdoC7tYv0Ydg7do1-Ad6hm8RwcGH5BnMEPc4BpFBrcoNbhDucFPNIkSxQVoI_SNQCNPhhCO9FyGSITnKhxDWAgkkgD7amIShUIn-lpCaICUZKH-JU18L1EmooRFmf4ByUzo2yJAzFM4SrAKOQ5BupjpuYLtTEp_x6H-otDefm9nf6vb3X25g_cODg9fdPp4BTN4MxyksQ9FC4d-s7Toj_959A0O9F3so2NbiWhMqC2zOFKkNExK1PZT0fHgfhWXCjsuvkAYihIIBlXYK8tVFfNpxpk6wg42ruWD1IhdoTDZoEZbD2WCyzxWEswXVyYLAzCJORwSUvUW4Dlu1OtGVaDB0j7wyWIYXUwROf_XMPOk6XZvXC5z_z2NuR2nAVm42rg0zFef1tdLuFnINVZ6OEbJciHojU6h3n7FzyVZ9oQbSYUiFE5xRVvFvzWbFfwL)
## Ungolfed and somewhat explained
In UTF-8, all the accented character are 2 bytes, the first of which is always 195. The second can be calculated from the base letter.
```
char:       A   E   I   O   U   a   e   i   o   u
code:      65  69  73  79  85  97 101 105 111 117
 &12:       0   4   8  12   4   0   4   8  12   4
 &16:       0   0   0   0  16   0   0   0   0  16
    
with \:   128 136 140 146 153 160 168 172 178 185
with /:   129 137 141 147 154 161 169 173 179 186
with ^:   130 138 142 148 155 162 170 174 180 187
code to \: 63  67  67  67  68  63  67  67  67  68
code to /: 64  68  68  68  69  64  68  68  68  69
code to ^: 65  69  69  69  70  65  69  69  69  70
              |---same---|        |---same---|
```
For most letters, we just increase character code by 67 (for `Aa`, increase by 63, for `Uu` increase by 68), then offset by 0, 1, or 2 to add the hat.
```
s => s.replace(  // replace each word
  /\S+/g,
  w => w.replace(  // replace each vowel
    x = /[aeiou]/gi,
    c => v-- ?            // if this is not the vowel to replace
      c :                     // don't replace
      Buffer(c + c).map(      // otherwise create a Buffer of 2 bytes
        (n, j) => j ?         // map (replace) each byte; if it's the 2nd byte
          n                   // start at n
          + 68                // add 68
          - 4 * !(n & 12)     // subtract 4 if it's 'A' or 'a'
          - !(n & 16)         // subtract 1 if it's not 'U' or 'u'
          + 3 * r() | 0 :     // add randomly 0, 1, or 2 (and floor it)
          195                 // set the first byte to 195
      ),
    v = (r = Math.random)() * w.match(x)?.length | 0  // choose vowel
  )
)
```
[Answer]
# [Perl 6](https://perl6.org), 101 bytes
```
~*.words.map: {(my$p=m:ex:i/<[aeiou]>/».to.pick)~~Mu:D??~S/.**{$p}<(/{("\x300".."\x302").pick}/!!$_}
```
[Try it](https://tio.run/nexus/perl6#NZDLToNQEIb3PMWUkHKJHhqNLqC0mmgaE6tNGzf1FuRSThTOCRxKCYHnceUL6EoeDIGDq/n@f/7JTCZNPNifI8cUhDCHsUNcD6ym0lBGYjdBoU0NKJQwl6gVGt7BwPr00fYwSZ9n@u83YgRR7LyrVbVMjav5vNroSNMKiZZTRS8U8elwOpmICPVwIqp9utRHI@m1bPjOCxzRlIEFigAgZzhiXiwfdfxmJwGnOMhZEA4c7cBnGReOzQBHwAIPAptxz60/E04scYL6JxkUjXHkYFp/cbla3y/Wl8vlzd0CVg/b7e31BsbQP2BHPvw2pLYH@iT@v/B4BhKnop3vahdWuKdCl3w5M4eWLJtC2fwB "Perl 6 – TIO Nexus")
## Expanded:
```
~      # stringify (join with spaces)
*\     # Whatever lambda (input parameter)
.words # split into words
.map:  # for each word
{ # bare block lambda with implicit parameter ｢$_｣
  (
    my $p =
    m
    :exhaustive               # all possible matches
    :ignorecase
    /<[aeiou]>/\              # match a vowel
    ».to.pick                 # pick one of the positions
  ) ~~ Mu:D                   # is it defined ( shorter than ｢.defined｣ )
  ??                          # if ｢$p｣ is defined
    ~                         # stringify
    S/
      . ** {$p}               # match ｢$p｣ positions
      <(                      # ignore them
    /{
      ("\x300".."\x302").pick # pick one of the "hats" to add
    }/
  !!                          # if ｢$p｣ is not defined    
    $_                        # return the word unchanged
}
```
[Answer]
## C#, ~~273~~ 267 bytes
```
using System.Linq;A=s=>{var r=new System.Random();var a=s.Split(' ');return string.Join(" ",a.Select(w=>w.Select((c,i)=>"AEIOUaeiou".Any(d=>c==d)?i:-1).Where(x=>x>=0).ToList()).Select((l,i)=>l.Any()?a[i].Insert(l[r.Next(l.Count)]+1,""+(char)r.Next(768,771)):a[i]));};
```
[repl.it demo](https://repl.it/EsX5/1)
I really feels like I'm cheating, since I still add hats to already accented vowels created by [combining characters](https://en.wikipedia.org/wiki/Combining_character). If that is not acceptable, let me know so I can ~~add boilerplate codes~~ declare this answer non-competing.
This thing adds a random character among [U+0300](http://www.fileformat.info/info/unicode/char/0300/index.htm) or [U+0301](http://www.fileformat.info/info/unicode/char/0301/index.htm) or [U+0302](http://www.fileformat.info/info/unicode/char/0302/index.htm), after a random vowel of each input word (if any).
Ungolfed (lambda body only)
```
var r=new System.Random();
// Split sentence to array of words
var a=s.Split(' ');
// Join the (hat-ed) words back to sentence
return string.Join(
    " ",
    // Select an IEnum of list of integers indicating the positions of vowels
    a.Select(w=>
        w.Select((c,i)=>
            // If it's vowel, return position (>=0), else return -1
            "AEIOUaeiou".Any(d=>c==d)?i:-1
        // Filter vowels only
        ).Where(x=>x>=0)
        .ToList()
    // Convert each list of integers to hat-ed words
    ).Select((l,i)=>
        l.Any()
            // Insert "something" into the word...
            ?a[i].Insert(
                // ...at the position after a random vowel in that word...
                l[r.Next(l.Count)]+1,
                // "something" is a random integer in [0x0300, 0x0303), then casted to UTF16 i.e. [U+0300, U+0302]
                ""+(char)r.Next(768,771))
            // List is empty => just return original word
            :a[i]));
```
[Answer]
# Mathematica, 226 bytes
```
Join@@((p=Position[w=#,Alternatives@@(v=Characters@"aeiouAEIOU")];If[p!={},i=#&@@RandomChoice@p;w[[i]]=FromCharacterCode[ToCharacterCode["àèìòùÀÈÌÒÙ"][[#&@@Position[v,w[[i]]]]]+RandomInteger@2]];w)&/@Split[#,{##}~FreeQ~" "&])&
```
Unnamed function taking a list of characters as input and returning a list of characters. Easier-to-read version, slightly ungolfed as well:
```
 1  v = Characters["aeiouAEIOU"];
 2  a = ToCharacterCode["àèìòùÀÈÌÒÙ"];
 3  Join @@ (
 4    (p = Position[w = #, Alternatives @@ v]; 
 5      If[p != {},
 6        i = First[RandomChoice[p]]; 
 7        w[[i]] =
 8          FromCharacterCode[
 9            a[[ First[ Position[ v, w[[i]] ] ] ]] + RandomInteger[2]
10          ]
11        ]; w
12    ) &
13  ) /@ Split[#1, FreeQ[{##1}, " "] &] &
```
Line 13 splits the input into words (sublists of characters) at all the spaces; each word is operated on by the function defined by lines 4-12, and the results joined back together again in a single list by line 3.
Line 4 sets `p` to the list of indices indicating which characters of the word `w` are vowels. If there are any vowels (line 5), we make a random choice of one such index `i` (line 6) and then reset that single character of the word to a new character (lines 7-10). Finally we output the (possibly modified) word `w`.
To select the new character, we find where the vowel to be replaced sits in the string `v` and choose the corresponding character code from `a`. But to randomly select the three hats, we take that code and add a random integer between 0 and 2 (line 9) before converting back to a character. (Fortunately the behatted vowels all come in consecutive trios of UTF-8 character codes.)
[Answer]
# Python 3, 170 bytes
```
from random import *
c=choice
print(' '.join([w,w[:i]+c('̀́̂')+w[i:]][i>0]for w in input().split()for i in[c([j+1 for j,x in enumerate(w)if x in 'aeiouAEIOU']or[0])]))
```
Ungolfed:
```
from random import choice
print(' '.join([
                   w,  # Don't modify the word if no vowels were found
                   w[:i] + choice('̀́̂') + w[i:]
               ][i > 0]
               for w in input().split()
                   for i in [choice([j + 1 for j, x in enumerate(w) if x in 'aeiouAEIOU']
                                    or [0])  # choice requires a non-empty sequence
                             ]))
```
[Answer]
# [Python 3](https://docs.python.org/3/), 162 bytes
```
from random import*
print(*(w.insert(*choice([(n+1,q)for n,c in enumerate(w)if c in'AEIOUaeiou'for q in'̀́̂']or[(0,'')]))or''.join(w)for*w,in input().split()))
```
[Try it online!](https://tio.run/##TVG7TgMxEOz9FasU@ByiCESHBBJFQEhAEI@GKEIXxxcb7uxjz9FBB3wGHVSAEAU1ndv8U1hfeFU7M54Z2evyxmtn1@bSjdVGq9WaZ@gKwNSOaZiidOjbrERjfdJO6q6xlUKCUjsjVTJI7PJq50pkDsF2JBgLyk4LhalXSS1MBlHjW73d/mmqjJvy6LyK2ux2dje750OHg2Slw7kYCuGQ8@6FM5ayZGzXHSo0tpz6RHSrMjc0hZjTNRlDlebnzRlsLDyM1drkCk5wqtYZgMebOAB@XHlajMbpOvxFf2s5bAIXg5VhE1DXSiZxI4JFIlXpodff7iE6XFSOqONyXtNaFFI0gvCCbJRWmugoPFWaoabdFkQXgKGdQObrKCwQk6mPK/NagSa4CTI8eQhvUQqvoMOjZ@PwXNFJHMxXUofPKvIf2PyNNGV4J7FEyjaEHR71d4629vd3D3bg8PTsbK93DEsQ3wQTl2dkbhzh/tsSHv55wgtMwkeefQE "Python 3 – Try It Online")
]