text:
Plant a binary forest!
Inspired by A014486.
Challenge
Given an integer input in base 10, construct a representation for the binary forest corresponding to the input. Representations include, but are not limited to, nested arrays and strings.
How?
Convert the input to binary. 1s represent branches, and 0s represent leaves.
To make this easier to understand, let's use 834 (1101000010 in binary) as an example.

We start with the first digit. The first digit is a 1, so we draw branches:

\ /
 1

or as an array, {{1}}

The next digit is 1, so we draw more branches (we go from left to right):

\ /
 1
  \   /
    1

or as an array, {{1, {1}}}

The next digit is 0, so we place a leaf:

0
 \ /
  1
   \   /
     1

or as an array, {{1, {1, 0}}}

The next digit is a 1, so we place a branch:

     \ /
0     1
 \   /
   1
      \     /
         1

or as an array, {{1, {1, 0, {1}}}}

Repeating the process, we obtain the following tree after the 8th digit:

    0   0
     \ /
0     1
 \   /
   1           0
      \     /
         1

or as an array, {{1, {1, 0, {1, 0, 0}}, 0}}

For the remaining digits, we draw more trees:
The 9th digit is a 0, so we place a leaf (aww, it's a young shoot!)

    0   0
     \ /
0     1
 \   /
   1           0
      \     /
         1         0

or as an array, {{1, {1, 0, {1, 0, 0}}, 0}, 0}

When we use all the digits, we end up with this:

    0   0
     \ /
0     1
 \   /
   1           0       0
      \     /           \ /
         1         0     1

or as an array, {{1, {1, 0, {1, 0, 0}}, 0}, 0, {1, 0}}

That looks weird, so we pad a zero to complete the tree:

    0   0
     \ /
0     1
 \   /
   1           0       0   0
      \     /           \ /
         1         0     1

or as an array, {{1, {1, 0, {1, 0, 0}}, 0}, 0, {1, 0, 0}}
Note that the flattening the array yields the original number in binary, but with a padded zero.
Criteria

The output must clearly show the separation of the trees and branches (if it is not a nested array, please explain your output format).
Extracting all digits from the output must be identical to the binary representation of the input (with the padded zero(s) from the above process).

Test cases
The output may differ as long as it meets the criteria.

0    -> {0}
1    -> {{1, 0, 0}}
44   -> {{1, 0, {1, {1, 0, 0}, 0}}}
63   -> {{1, {1, {1, {1, {1, {1, 0, 0}, 0}, 0}, 0}, 0}, 0}}
404  -> {{1, {1, 0, 0}, {1, 0, {1, 0, 0}}}}
1337 -> {{1, 0, {1, 0, 0}}, {1, {1, {1, 0, 0}, {1, 0, 0}}, 0}}

Scoring
This is code-golf, so lowest bytes wins!

I would avoid using bonuses - it generally doesn't improve the challenge.

@Sanchises I added the bonus to see answers with visualization... How else could I encourage people to try making a visualization as the output?

(re your comment) Require it?

@JungHwanMin Look at what I linked in more detail (especially the comments); or, in the same Meta question, this answer. Your current question asks for posters to create 2^2=4 programs, and calculate the score of each program, before submitting the best scoring program. Either require it when you think it makes for a better challenge, or remove it if you feel it makes for a worse challenge.

@JungHwanMin Fair enough. They must golf 3 programs and calculate each individual score before submitting an answer. What you have here, is three challenges wrapped into one. I would recommend posting the visualization as a separate challenge.

Is this possible in Homespring? If so somebody do it (homespring is related because the trees are constructed somewhat similar to this)

How large numbers must we support? Is 9*10^15 (53 bits) a large enough upper limit?

@Pietu1998 Yep. That's good enough.

is visualisation still allowed? It does seem to be.

@DestructibleWatermelon of course, as long as it represents the binary forest

that seems slightly unclear. doesn't a number then represent the binary forest?

@DestructibleWatermelon I want the output to have clear separation of branches and trees

JavaScript (ES6), 96 89 80 79 74 73 bytes

f=($,_=~Math.log2($))=>0>_?[(g=f=>$&1<<~_++&&[1,g(),g()])(),...f($,_)]:[]
<input type="number" value="1337" oninput="document.querySelector('#x').innerHTML=JSON.stringify(f(+this.value))"/>

Defines a function f that returns a nested array. The HTML code is just for testing.

For a second I was thinking "what the heck is $& doing without .replace?" :P

@ETHproductions I kinda got bored and obfuscated the variable names. Too bad JS doesn't allow for other single-symbol ones :D

Befunge, 138 117 104 bytes
p&1v
%2:_v#:/2p9p00+1:g00
3\9g<>$\:!v!:<
9g!v ^,"}"_1-\1-:
"0"_2\"1{",,:|:,
`#@_\:#v_"}",>$\:8
,"0":-1<^

Try it online!
Explanation
Line 1 reads a number from stdin, and line 2 converts that number to a binary sequence which it stores in the playfield on line 10. Lines 3 to 5 then iterate over those binary digits, outputting the appropriate tree representation as each digit is processed. The Befunge stack is used to keep track of the depth into the tree and how much leaf space is left at each level so we know when to create a new branch. Lines 6 and 7 handle the final 0 padding to fill up any empty leaves.
In order to golf this as much as possible, I removed the commas from the output as well as the extraneous outer braces. This still hasn't beat the Mathematica solution, but it's been fun trying.
If you want to see what it looked like with the original verbose output format, I saved an earlier version of the code here (131 bytes).

(this doesn't have enough upvotes :D)

Mathematica, 115 109 108 104 98 bytes
(i=#~IntegerDigits~2;f:=Switch[If[i=={},0,i={##2};#]&@@i,0,0,1,f~1~f];NestWhileList[f&,f,i!={}&])&

Generates error messages that can safely be ignored. Outputs a binary forest. It's slightly different from the sample output because 1 is a Head, not the first element of a list. (e.g. 1[0, 0] instead of {1, 0, 0})
Error-free version (104 bytes)
(i=#~IntegerDigits~2;f:=Switch[If[i=={},i={0}];(i={##2};#)&@@i,0,0,1,f~1~f];NestWhileList[f&,f,i!={}&])&

Explanation
i=#~IntegerDigits~2;

Convert input to a base-2 list. Store it in i.
f:=

SetDelay f the following (evaluated whenever f is called):
Switch[If[i=={},0,i={##2};#]&@@i,0,0,1,f~1~f]

Switch statement.
First, if i is empty, output 0. If not, output the first element of iand drop it from the list. Use the output as the control variable.
If the control variable is 0, output 0. If it is 1, output 1[f, f] (recursive).
NestWhileList[f&,f,i!={}&]

While i is not empty, keep calling f. Output the result, wrapped with List.
Example
(i=#~IntegerDigits~2;f:=Switch[If[i=={},0,i={##2};#]&@@i,0,0,1,f~1~f];NestWhileList[f&,f,i!={}&])&[1337]

{1[0, 1[0, 0]], 1[1[1[0, 0], 1[0, 0]], 0]}

Alternative solution (120 bytes)
Identical to my 104 byte solution but converts the output into the format given in the question.
(i=#~IntegerDigits~2;f:=Switch[If[i=={},i={0}];(i={##2};#)&@@i,0,0,1,f~1~f];NestWhileList[f&,f,i!={}&]//.1[a__]:>{1,a})&

Mathematica, 167 161 bytes
b=Append;a=If[#&@@#>0,a[Rest@#~b~0,a[#,#3[#,{1,#4,#2},##5]&,#3,#2,##4]&,#2,##3],
#2[Rest@#~b~0,0,##3]]&;a[#~IntegerDigits~2,If[c=#3~b~#2;Tr@#>0,a[#,#0,c],c]&,
{}]&

Anonymous function. Takes a number as input, and returns an arbitrarily nested list of numbers as output. Line breaks added for clarity. Uses some mechanism involving continuations, but I'm too tired to think about it any longer.

#[[1]] to #&@@# should save a byte. !#~FreeQ~1 instead of #~MemberQ~1 saves a byte as well.

Python 2, 133 118 117 bytes
Partially recursive, partially iterative. I tried using an integer, but the tree starts with the most significant bits, so I don't think it's worth it.
def t():global b;a=b[:1];b=b[1:];return a and'0'=s.length||s[p]=='0'){r+="0";p++;return;}else{r+="{1";p++;g(s,k+1);g(s,k+1);r+="}";}if(k==0&&p<s.length)g(s,0);}public static void main(String[]a){java.util.Scanner q=new java.util.Scanner(System.in);r+="{";g(Integer.toBinaryString(q.nextInt()).toCharArray(),0);r+="}";System.out.print(r);}}

Ungolfed:
class f{
    static String r="";
    static int p=0;
    static void g(char[]s,int k){
        // if there's empty space in last tree or current character is a 0
        if(p>=s.length || s[p]=='0'){
            r+="0";
            p++;
            return;
        }
        // if current character is a 1
        else{
            r+="{1";
            p++;
            // left branch
            g(s,k+1);
            // right branch
            g(s,k+1);
            r+="}";
        }
        // if they're still trees that can be added
        if(k==0 && p<s.length)g(s,0);
    }
    public static void main(String[]a){
        java.util.Scanner q=new java.util.Scanner(System.in);
        r+="{";
        g(Integer.toBinaryString(q.nextInt()).toCharArray(),0);
        r+="}";
        System.out.print(r);
    }
}

DUP, 84 bytes (82 chars)
0[`48-$1_>][\10*+]#%1b:[$1>][2/b;1+b:]#[['{,1.b;1-b:FF'},][0.b;1-b:]?]⇒F[b;0>][F]#

For golfing reasons, I got rid of the outer curly braces and the commas because they are not necessary for reconstructing the trees.
Example outputs:
0      → 0
1      → {100}
44     → {10{1{100}0}}
63     → {1{1{1{1{1{100}0}0}0}0}0}
404    → {1{100}{10{100}}}
1023   → {1{1{1{1{1{1{1{1{1{100}0}0}0}0}0}0}0}0}0}
1024   → {100}00000000
1025   → {100}0000000{100}
1026   → {100}000000{100}
1027   → {100}000000{1{100}0}
1028   → {100}00000{100}
1337   → {10{100}}{1{1{100}{100}}0}
4274937288 → {1{1{1{1{1{1{10{1{100}{1{1{100}{10{1{1{10{1{1{100}{100}}0}}0}0}}}0}}}0}0}0}0}0}0}
4294967297 → {100}00000000000000000000000000000{100}

Explanation:
0[`48-$1_>][\10*+]#           While loop to read in the characters and convert them into a
                              base-10 integer.
0                             Push 0 (temporary value)
 [`48-$0>]       #            While input character-48 (digit)>-1
          [     ]
           \                      Swap top values
            10                    Push 10
              *                   Multiply (temporary value by 10)
               +                  Add to input value
%                                 Pop stack (EOL)
1b:                           Variable b=1 (bit count)
[$1>][2/b;1+b:]#              While loop to convert the number to base-2 digits on the
                              data stack, MSB on top. Each iteration increments bit count b.
[$1>]          #              While (DUP>1)
     [        ]#
      2                           Push 2
       /                          MOD/DIV (pushes both mod and div on the stack)
        b;1+b:                    Fetch b, increment, store b

[['{,1.b;1-b:FF'},][0.b;1-b:]?]⇒F
[                             ]⇒F     Define operator F:
                                      pop top stack value
 [                ]          ?        if value != 0:
  '{,1.                                   print '{1'
       b;1-b:                             fetch b, decrement b, store b
             F                            execute operator F
              F                           execute operator F again
               '},                        print '}'
                   [        ]?        if value == 0:
                    0.                    print '0'
                      b;1-b:              fetch b, decrement b, store b
[b;0>][F]#
[b;0>]   #                            While (fetch b, b>0==true)
      [F]#                                execute operator F

Try it out with the online Javascript DUP interpreter on quirkster.com or clone my GitHub repository of my DUP interpreter written in Julia.


text:
Generate a random derangement
Challenge description
A "derangement" of a sequence is a permutation where no element appears in its original position. For example ECABD is a derangement of ABCDE, but CBEDA is not:
ABCDE
 | |   <- B and D are in their orignal positions
CBEDA

Given a sequence, generate a random derangement of it.
Notes

You may take either a string as an input or an array/list of elements (integers, chars, objects...)
Instead of returning a new object, you can modify an existing one by swapping its elements
Each derangement should have an equal probability of being generated
You may assume that there is more than one element in the sequence and none appear more than once

Related?

@VoteToClose: haha, totally busted

I don't know much about all this but is this in any way related to the fixed point theorem... according to which things will always end up in their own position or something like that...? I'll wager I'm wrong but someone please  correct me :)

Is there any guarantee that the elements will be unique, or can they contain duplicates?

@Carcigenicate: it's right there in the description; you may assume there are no duplicates

@shooqie Whoops, sorry. Missed the last point.

If I take a random amount of chars (1 - (len()-1)) from the beginning of the string and set them to the end, does it count? Ie. ABCDE -> CDEAB

I don't think the distribution of derangements would be uniform then.

CJam, 14 bytes
q:X{mr_X.=:|}g

Try it online!
Keeps shuffling the input until it's a derangement.
Explanation
q:X   e# Read input and store it in X.
{     e# While the condition at the end of the loop is truthy...
  mr  e#   Shuffle the string.
  _X  e#   Duplicate it and push the input.
  .=  e#   Element-wise equality check.
  :|  e#   Reduce OR over the list, gives something truthy if any character
      e#   remained in its original position.
}g

I wish OP had specified that solutions would have to guarantee they always finish.

@JanDvorak Well, the probability that this doesn't finish is 0. But you're right that requiring a deterministic running time would have made the challenge more interesting.

Is the probability actually 0? The shuffle operation won't be perfect, how does it actually work? I think this probably is a good approximation of what the OP asked for, but I doubt the probabilities of each derangement are the same (probably it depends on some seed value of the PRNG which is likely used by the shuffle operation).

@Nobody I doubt you can get perfectly uniform results from a PRNG using any algorithm whatsoever. However, assuming that the shuffle itself is uniform (which the Java docs sort of guarantee with "All permutations occur with approximately equal likelihood."), a rejection-based solution will also yield uniform derangements, because each derangement is one permutation, and each permutation has the same probability.

@Nobody Math nerd here. A condition that either succeeds or fails is called a Bernoulli trial in statistics. This implies that the probability of the needing k trials to first success is (1 - p)^(k - 1) * p, where p is the probability of a successful derangement. It's easy to see that as k grows larger, the probability of needing k trials becomes vanishingly small. Therefore, we say the algorithm halts with probability 1 ("almost surely"), yet it is not impossible that it never halts.

Jelly, 6 bytes
Ẋ=³S$¿

Try it online!
Explanation
Ẋ    ¿    Shuffle the given list while this is nonzero for it:
    $       A two-step process:
 =³           Element-wise equality of it and L (the original list)...
   S          Sum the ones in this binary array.

Jonathan Allan saved a byte.

So you got your Winter Bash hat ahead of time? :-)

Time to draw a nice new picture, Ẋ=³S$¿ saves a byte.

Huh, I never knew that about $. Thanks!

It's 6 chars, but more than 6 bytes. Ẋ=³S$¿ byte lengths are: 312112. So 10 bytes in total.

Python, 85 bytes
Modifies the list passed to it (allowed by meta and in the question).
from random import*
def D(l):
 o=l[:]
 while any(x==y for x,y in zip(o,l)):shuffle(l)

Try it online here!

If you specify Python 2, I think you could replace def D(l): with l=input() and then save the indentation spaces in the following lines (so you have a program instead of a function). Did not downvote, though!

@mathmandan good idea, but then I'd need to print it back out again if it's a full program, which costs more bytes.

OK, if you say so.  I guess to me the spec seemed to be saying that you didn't have to print out or return the result--that taking a list [from user input] and shuffling it would be sufficient.  But it's reasonable to read "existing" as "existing prior to running any of your code", in which case I agree with you.  (Maybe there's a well-established consensus on this.)  :)

ES6 (Javascript), 71, 69 bytes
Input and output are arrays, should work with any element types (strings, numbers e.t.c.), as long as they can be compared with "==".
Golfed
F=s=>(r=[...s]).sort(_=>Math.random()-.5).some((e,i)=>s[i]==e)?F(s):r

Test
F=s=>(r=[...s]).sort(_=>Math.random()-.5).some((e,i)=>s[i]==e)?F(s):r

F(['A','B','C','D'])
Array [ "D", "C", "A", "B" ]

F(['A','B','C','D'])
Array [ "D", "A", "B", "C" ]

F(['A','B','C','D'])
Array [ "C", "D", "B", "A" ]

F(['A','B','C','D'])
Array [ "D", "C", "B", "A" ]

F(['A','B','C','D'])
Array [ "C", "D", "B", "A" ]

Interactive Snippet

F=s=>(r=[...s]).sort(_=>Math.random()-.5).some((e,i)=>s[i]==e)?F(s):r

function G() {
    console.log(F(T.value.split``).join``);
}
<input id=T value="ABCDEF"><button id=G onclick="G()">GENERATE</button>

Perl 6, 33 bytes
{first (*Zne$_).all,.pick(*)xx *}

A lambda that takes a list of integers or characters as input, and returns a new list.
If it must support lists of arbitrary values, ne would have to be replaced with !eqv (+2 bytes).
(Try it online.)
Explanation:

{ }: Defines a lambda.
.pick(*): Generates a random shuffle of the input list.
.pick(*) xx *: Creates a lazy infinite sequence of such shuffles.
(* Zne $_).all: A lambda that zips two lists (its argument *, and the outer lambda's argument $_) with the ne (negative string equality) operator, yielding a list of booleans, and then creates an all junction to collapse them to a single boolean state.
first PREDICATE, SEQUENCE: Takes the first element from our infinite sequence of permutations that fulfills the "derangement" test.

MATL, 7 bytes
This is a translation of my Octave post (and similar to some of the other submissions here). I posted my first MATL post yesterday (CNR crack), so I guess this is not optimal, but it's the best I've got so far.
To be honest, I'm not entirely sure t is needed in there, but it's the only way I can get this to work. It's used so that I can compare the user input (retrieved with G), with the random permutation. I would think I could compare the two without it, but...?
Anyway, here goes:
`Z@tG=a

`          % Loop
 Z@        % Random permutation of input
   t       % Duplicating the stack
    G      % Paste from clipboard G (user input)
     =     % Comparing the random permutation with the input (retrieved from clipboard)
      a    % any(input == random permutation)
           % Implicit end and display

Try it online!

Any improvements? Do I really need t there or can I get rid of it? It was fun trying to golf in MATL... :)

:-) I don't see how to get rid of that t (or equivalently another G) You need to leave something on the stack for the  next iteration or as final result

Brachylog, 19 18 15 13 bytes
@~.:?z:#da;?&

Try it online!
Explanation
@~.                Output is a shuffle of the input
  .:?z             Zip the output with the input
      :#da         All couples of integers of the zip must be different
          ;      Or
           ?&      Call recursively this predicate with the same input

Actually, 13 bytes
;;WX╚│♀=ΣWX)X

Try it online!
Explanation:
;;WX╚│♀=ΣWX)X
;;             make two copies of input
  WX╚│♀=ΣW     while top of stack is truthy:
   X             discard top of stack
    ╚            shuffle array
     │           duplicate entire stack
      ♀=         compare corresponding elements in shuffled and original for equality
        Σ        sum (truthy if any elements are in the same position, else falsey)
          X)X  discard everything but the derangement

Perl 6, 45 bytes
{(@^a,{[.pick(*)]}...{none @a Zeqv@$_})[*-1]}

{(@^a,{[.pick(*)]}...{!sum @a Zeqv@$_})[*-1]}

Try it
Input is an Array of anything.
Expanded:
{
  (

    @^a,          # declare parameter, and seed sequence generator

    {             # lambda with implicit parameter ｢$_｣
      [           # store into an array
        .pick(*)  # shuffle ｢$_｣
      ]
    }

    ...           # keep generating the sequence until

    {
      none        # none
      @a          # of the outer blocks input
      Z[eqv]      # is zip equivalent
      @$_         # with the current value being tested
    }

  )[ * - 1 ]      # return the last value
}

Mathematica, 57 bytes
#/.x_:>RandomChoice@Select[Permutations@x,FreeQ[#-x,0]&]&

Unnamed function taking a list of whatevers as input and outputting a list. After generating all permutations # of the input x, we keep only the ones for which the set #-x of element-wise differences doesn't contain a 0; then we make a (uniformly) random choice from that set.

nice! Slightly longer #/.x_:>NestWhile[RandomSample[#,Length@#]&,#,Not@FreeQ[#-x,0]&]& obviously quicker in practice for long strings

Wait, you're telling me there is no built-in for derangements in Mathematica? :o

I was half expecting a built-in myself :)

Octave, 56 55 bytes
x=input('');while any(x==(y=x(randperm(nnz(x)))));end,y

We have to use input('') since this is not a function. Also, since I can choose to have the input as a string we can use the trick that nnz(x)==numel(x).
Explanation:
x=input('')            % Self-explanatory
while any(x==y)        % Loop until x==y has only 0s (i.e. no elements are equal)
y=x(randperm(nnz(x)))  % Continue to shuffle the indices and assign x(indices) to y
end                    % End loop
y                      % Display y

Thanks to Luis for noticing that the input can be a string, thus I could use nnz instead of numel saving two bytes.

Note to self: Read the entire question next time :) Thanks!

That happens to me all the time :-)

Pyth - 10 9 bytes
This keeps on shuffling the input while any of the characters equal the characters at their index in the input.
.WsqVHQ.S

Try it online here.
.W           Iterate while
 s           Sum, this is works as any() on a boolean list
  qV         Vectorized equality
   H         The lambda variable for the check step
   Q         The input
 .S          Shuffle
  (Z)        Lambda variable, implicit
 (Q)         Start .W with input, implicit

Can you please add an explanation. I wanted to write a pyth answer. I don't know much about it.

@GurupadMamadapur sure, would be happy too.

@GurupadMamadapur added. We have a tutorial. Its pretty out of date, but will teach you the basics. If you need any help with anything related to pyth, feel free to ping me in chat.

MATL, 13 bytes
This is a joint effort of @LuisMendo and me. In contrast to many other answers here this one is deterministic in the sense that it does not sample random permutations until it gets a derangement, but it generates all derangements and chooses one randomly.
Y@tG-!Af1ZrY)

Try It Online!
Explanation
Y@tG-!Af1ZrY)
Y@             generate all permutatoins
  t            create a duplicate
   G-!A        find the (logical) indices of all valid derangements (where no character of the string is in the same position as the original string)
       f       convert logical to linear indices
        1Zr    choose one of those indices randomly
           Y)  get the derangement (from the ones we generated earlier) at this index

Octave,  54 53 bytes
@(a)((p=perms(a))(L=!any(p==a,2),:))(randi(sum(L)),:)

Generate all permutations of a and select randomly a row that doesn't have a common element with a .
note: It is accidentally the same as @flawr MATL answer!

Ruby, 67 bytes
def f a
while (a.zip(o=a.shuffle).map{|x,y|x-y}.index 0);end
o
end

PHP, 85 bytes
for($a=$b=str_split($argv[1]);array_diff_assoc($a,$b)!=$a;)shuffle($b);echo join($b);

Copies the string argument to two arrays, shuffles one of them until the difference between them (also comparing indexes of the elements) equals the other one. Run with -r.

Wonder, 32 bytes
f\@[/>#I zip#=[#0a\shuf#0]?f a?a

Usage:
f\@[/>#I zip#=[#0a\shuf#0]?f a?a];f[1 2 3 4 5]

Explanation
More readable:
f\@[
  some #I zip #= [#0; a\ shuf #0]
    ? f a
    ? a
]

Recursive function f. Does an element-wise comparison between f's input list and and a shuffled version of the input list. If the comparison yields any equal values, then f is called on the shuffled list. Otherwise, we simply return the shuffled list.

R, 59 bytes
z=x=1:length(y<-scan(,""));while(any(x==z))z=sample(x);y[z]

Reads a list of elements to STDIN, takes the length of the list and starts sampling ranges from 1 to the length, until it finds one that shares no places with the ordered list. Then prints that list.

Clojure, 94 90 79 bytes
#(let[s(shuffle %)](if(not(some(fn[[x y]](= x y))(map vector % s)))s(recur %)))

-4 bytes by changing the conditional inside the reduction to an and, and inlining done?.
-11 bytes by converting the reduction to some.
WOOT! Beat PHP.
Brute-force method. Shuffles the list while it's invalid. This finishes stupid fast considering it's a brute force method that does nothing to prevent duplicate tries. It found 1000 dearangments of a 1000 element long list in less than a second.
Ungolfed:
(defn dearang [ls]
  (let [s (shuffle ls)
        bad? (some (fn [[x y]] (= x y))
                (map vector ls s))]
    (if (not bad?) s (recur ls))))

Clojure, 56 bytes
#(let[s(shuffle %)](if((set(map = % s))true)(recur %)s))

Note that a string cannot be shuffled, must be passed through seq or vec.
Originally I tried #(first(remove(fn[s]((set(map = % s))true))(iterate shuffle %))) but recur approach is indeed shorter than iterate.
The magic is that (set(map = % s)) returns either a set of false, set of true or set of true and false. This can be used as a function, if it contains true then the answer is true, otherwise falsy nil. = is happy to take two input arguments, no need to wrap it with something.
((set [false]) true)
nil

Maybe there is even shorter way to check if any of the values is true?

APL, 11 bytes.
With the string in the right argument:
⍵[⍋(⍴⍵)?⍴⍵]
Explanation
ρ⍵ gets the length (or shape) of the right argument.
? returns a random array of (⍴⍵) of these numbers.
⍋ returns the order of them in order to ensure no duplicates.
⍵[..] represents the random assortment of the string using this index.

Welcome to PPCG! We require all entries to be valid functions or full programs, so your answer needs to take input through a function argument or input method.

I think it should fit the requirements now. It takes in the right argument, or ⍵.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
This cat has bugs? Really?
Challenge:
Read input (within visible ASCII range) and output with a few modifications:

In each set of 10 characters of the input randomly (50/50):

replace one character* (with a random** one within visible ASCII range) (ex. lumberjack becomes lumbeZjack)
or remove one character (ex. lumberjack becomes lmberjack)

* If the set is of less than 10 characters, you don't have to modify it, but you can.
** The character can be the same as the one input, as long as it's still random.
Example:
Input: Go home cat! You're drunk!
Output: Go hom cat! YouLre drunk!
(just a example, since output could be random, don't use as a test case)
Rules:

code-golf, least characters wins!

@n4melyh4xor also you could post future challenges on the Sandbox. There you will get some feedback about your challenge.

What if the replacement char is the same as the char to be replaced?

@BradGilbertb2gills, I'm not that picky, it's fine.

Closely related

Does the index of the character to be replaced have to be random?

Does it have to be uniformly random, or just each character just need a non-zero chance of appearing?

Is the input guaranteed to be at least 10 characters long?

@FlipTack "If the set is of less than 10 characters, you don't have to modify it, but you can." I would interpret that as a no.

Is it acceptable just to alter 10% of characters at random, or does it have to be exactly one in each group of 10 characters?

Pyth, 27 25 bytes
VczTpXNOT?<JOr\ \ÞKC127JK

Test suite available here.
Thanks to Maltysen for shaving off 2 bytes.
Explanation
VczTpXNOT?<JOr\ \ÞKC127JK    z autoinitalizes to input, T autoinitializes to 10
 czT                         chop input into strings of length 10, returned as list of strings
V                            for each string N in this list:
            Or\ \Þ            randomly pick a char between ' ' (32) and 'Þ' (222)
           J                  and assign it to variable J
                  KC127       assign the DEL char to variable K
         ?<J      K           if J < K:
     XNOT              J       replace a random character in N with J
         ?<J      K           else:
     XNOT               K      replace a random character in N with K
    p                         print this string with no trailing newline

As is often the case, I feel that this is a bit of a naive method and may be improved upon. Usually I find something obvious while typing up the explanation but nothing jumped out at me this time.

Nice use of the delete char! One tip is that range operates on string too

@Maltysen Thanks! I have thought about your comment but I am not entirely sure where I could use it to save space. OC\¾ is the same number of bytes as O190, and assigning K to the delete char doesn't save any space either.

@Maltysen So it took me a little bit but I realized what you meant and I've shaved off 2 bytes. Thanks again!

*><>, 44 46 52 50 bytes
rl5(?voooo/!|Ou+1Ox:@=?~o~oooo!
ol5(?v" ":/
o;!?l<

Try it here!
This uses any ascii character near/above space for the random characters. This always edits the 6th character, unless it's the end of a string and that string's length isn't a multiple of 10. This has a 50% chance to remove the 7th character instead of editing the 6th.
Input

The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a
  technical standard for floating-point computation established in 1985
  by the Institute of Electrical and Electronics Engineers (IEEE). The
  standard addressed many problems found in the diverse floating point
  implementations that made them difficult to use reliably and portably.
  Many hardware floating point units now use the IEEE 754 standard.

Output

The IEE Standardfor Float$ng-Point Aithmetic (EEE 754) i a technicl
  standar! for floa!ing-point!computati#n establised in 1985by the
  Insitute of !lectrical#and Electrnics Engi!eers (IEE%). The st!ndard
  add!essed man! problems#found in !he divers! floating oint
  impl!mentation" that mad# them dif!icult to ue reliabl# and port!bly.
  Many!hardware foating po#nt units %ow use th! IEEE 754"standard.

Edit: This answer probably isn't always in the visible ascii range, editing... Fixed.
Edit2: Didn't see there needs to be a 50/50 chance to remove a character, editing again... I believe everything is in order now :).

One more thing, someone suggested a random character so it's random now.

@n4melyh4xor, that was me! It is random :).

Perl 6,  78  67 bytes
{[~] map {~S/.**{(^.chars).pick}<(./{(' '..'~').pick x Bool.pick}/},.comb(10)}

{[~] .comb(10)».&{~S/.**{10.rand}<(./{(' '..'~').pick x 2.rand}/}}

Try it
Explanation:
{
  [~]                  # reduce with string concatenation operator

  .comb(10)\           # take input and break it into chunks of up-to 10 chars

  ».\                 # on each of them call the following

  &{
    ~                  # Stringify the following

    S/                 # substituted
      .                # any char
        **             # repeated
           { 10.rand } # a random number of times

      <(               # ignore all of that

      .                # the char to be removed/replaced
    /{

      ( ' ' .. '~' ).pick  # choose a character
      x                    # string repeated
      2.rand               # zero or one times

    }/

  }
}

Pyth - 21 bytes
smO,XdOTOr;\~.DdOTcQT

Try it online here.

Python 3, 75 bytes
The 75-byte applies the transformation to the first character of each group, and only picks from 2 random characters, such as in the Jelly answer (which OP allowed):
from random import*
f=lambda s:s and choice(['','a','b'])+s[1:10]+f(s[10:])

Try it online!
This is a recursive function which, every iteration, prepends either nothing, 'a', or 'b', and then calls itself with the first 10 characters sliced off. The final iteration short circuits at s and (an empty string is falsy), avoiding infinite recursion.
The result of all the separate calls are then concatenated, and returned to the context which called the function.
120 bytes
Of course, that feels a bit like cheating, so here's one which is completely random:
from random import*;r=randint
def f(S):a=S[:10];R=r(0,len(a)-1);print(end=a[:R]+chr(r(32,126))*r(0,1)+a[R+1:]);f(S[10:])

Try it online!

Where did OP mention that the index of the replaced character can be 0?

@TuukkaX the comments have been removed to avoid clutter, but that's what the jelly answer does, and OP said it was fine.

Vyxal, 13 bytes
₀ẇ⟑ẏ℅kP¤"℅℅Ȧ₴

Try it Online!
₀ẇ            # Chunks of length 10...
  ⟑           # Over each...
           Ȧ  # Replace at ...
   ẏ℅         # random index in the input
          ℅   # A random item of...
         ℅    # A random item of...
     kP       # Printable ascii
       ¤"     # Or the empty string
            ₴ #

Looks like this gets applied once to the input as a whole when it should be applied to each grouping of 10 characters in the input.

@Shaggy Fixed..

It also looks like it only has a 1/96 chance to remove a character when it should be a 1/2 chance.

@Shaggy Fixed..

Jelly, 15 14  13 bytes 13 characters
2X
s⁵µ¢1¦ṫ¢µ€

TryItOnline!
Replaces or removes the first of every ten characters including that of the last 1-9 if there is such a chunk. Chooses from the, admittedly small, subset  of characters: 1; 2.
How?
2X         - Link 1, flip a coin: no arguments
 X         - random choice from
2          - 2 (treated as the integers [1,2])

s⁵µ¢1¦ṫ¢µ€ - Main link: string of printable ASCII
s⁵         - split (s) into chunks of size ten (⁵)
  µ     µ  - monadic chain separation
         € - for each chunk
   ¢       -     last link as a nilad
    1¦     -     apply to index 1 (replace 1st of the 10 char chunk with the chosen integer)
       ¢   -     last link as a nilad
      ṫ    - tail - if it was 1 this has no effect (50%)
                  - if it was 2 this discards the replaced character (50%)
           - implicit print

To choose from all of printable ASCII rather than just 1 and 2 (still replacing or removing the 1st character of each chunk) in 21 bytes:
s⁵µ32r126¤ỌX¤1¦ṫ2X¤µ€

For a fully random version (50/50 remove/replace, uniform random printable ASCII, and a uniformly random character location within each chunk) I have 30 bytes (probably non-optimal):
95R+31ỌX;

s⁵µṙ⁵X¤©Ṗ2X¤Ŀṙ®C¤µ€

This rotates each chunk left by a random amount, pops the last character off and then calls a random one of the first two links, one of which is empty and the other which concatenates with a random printable ASCII character; it then rotates the chunk right again.

This really goes against the spirit of the post

@Maltysen - OP said all these things are fine.

Where? I don't see anything in the comments or OP.

@Maltysen they have been cleared.

ok then, sorry about that. Can you make a trivial edit so I can undownvote you?

There was a comment explicitly saying we could choose from 2 characters AND that they did not want to put it into the Question body.

@Maltysen FWIW I have added a fully random version (although I'm sure it could be shorter!)

OP has stated that the least amount of characters wins. Jelly doesn't get affected by this though, unless it has multibyte characters.

@TuukkaX yeah, each byte is mapped to a character (one of the byte instructions has two possible characters, either a line feed or a pilcrow - which also has no effect); many of them would require more than one byte to represent with unicode (but it does not specify a byte count of the characters in a specific encoding).

...or each character maps to a byte

Clojure, 135 139 bytes
Edit: Forgot to use partition-all instead of partition.
(fn[i](apply str(flatten(map #(let[r rand-int [b e](split-at(r 9)%)][b(if(<(rand)0.5)""(char(+(r 25)97)))(rest e)])(partition-all 10 i)))))

Ungolfed:
(def f (fn[i]
         (->> i
              (partition-all 10)
              (map #(let [[begin end] (split-at (rand-int 9) %)]
                      [begin (if (< 0.5 (rand)) "" (char (+(rand-int 25)97))) (rest end)]))
              flatten
              (apply str))))

Man those function names are long... Anyway, it splits input into partitions of 10 characters, splits them at random point into two halves, randomly injects an empty string or a random character between them and discards the first character of the 2nd half.

Mathematica 133 Bytes (129 characters)
StringReplacePart[#,Table[If[(r=RandomInteger)[]<1,"",FromCharacterCode@r@128],c=⌊StringLength@#/10⌋],Array[{g=10#-9+r@9,g}&,c]]&

76 characters to write the names of 8 functions :/
Using the ⌊..⌋ instead of Floor[] saves 5 characters, 1 byte.

Python3, 188 186 184 114 characters
from random import*
s=input()
for c in[s[i:i+10]for i in range(0,len(s),10)]:print(end=choice(["","x","y"])+c[1:])

Seems too long. Could probably be shortened a lot with a lambda.
Apparently the OP has allowed choosing the random character from a list of two characters and the index of the character to be replaced can be a constant. After the modifications, my answer would've looked exactly the same as @FlipTacks Python submission, so this is the form I'm staying with.
@FlipTack saved 5 bytes!

Python 3, 129 bytes
def f(s):f=id(s)%9+1;print(''.join(j[0:f-1]+chr(33+id(s)%94)*(id(s)//10%2)+j[f:]for j in [s[i:i+10]for i in range(0,len(s),10)]))

In order to save some bytes, instead of importing Python's random module, I just did some modulo operations on the id of the string, which should be different every time. For example the program will decide whether or not to remove a char or replace one based on whether or not id(string)//10 is even (I integer divide by 10 as the last digit will always be even).

05AB1E, 13 bytes
TôεžQΩæΩ9ÝΩǝ?

Also (potentially) modifies the last part if it's less than 10 characters.
Try it online or see 10 example outputs at once.
Explanation:
Tô             # Split the (implicit) input-string into parts of size 10
               # (where the trailing part is potentially smaller)
  ε            # Foreach over the parts:
   žQ          #  Push the printable ASCII string constant
     Ω         #  Pop and push a random character from it
      æ        #  Get the powerset of this character, resulting in a pair of an empty
               #  string "" and the character
       Ω       #  Pop and push a random item from this pair
        9Ý     #  Push list [0,1,2,3,4,5,6,7,8,9]
          Ω    #  Pop and push a random digit from this list
           ǝ   #  Replace the character at that (0-based) index with the chosen ASCII
               #  character or the empty string
               #  (if the index is ≥ the length, it does nothing)
            ?  #  Pop and print the modified part

Ruby -pl, 52 bytes
gsub(/.{10}/){_1[rand 0..9]=[*" "..?~,""].sample
_1}

Attempt This Online!

Pip, 46 bytes
Fi(a<>t){IRR2YiRARR#iRCPAEL{YiRARR#ix}b:bAEy}b

Try It Online!
How?
Fi(a<>t){IRR2YiRARR#iRCPAEL{YiRARR#ix}b:bAEy}b
Fi      {                                   }  - For each in
      t                                        - Var for 10
   a<>t                                        - Split input into 10 pieces
         I                                     - If truthy
          RR2                                  - 0 or 1
             Y                                   - Yank (equivalent to (y:a)):
               RA                                 - Replace item in at index
              i                                   - First input
                 RR#i                             - Random int from 0 to length of input
                     RCPA                         - Random Printable ASCII character
                         EL{         }         - Else
                            Y                    - Yank:
                              RA                  - Replace item in at index
                             i                    - First input
                                RR#i              - Random int from 0 to length of input
                                    x             - Empty string
                                      b:       - Assign b to
                                        bAEy   - Append y to b
                                             b - Output b

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Appending String Lengths
Challenge:
Given a string s on the characters a-z, A-Z, 0-9, append the length of s to itself, counting the additional character(s) in the length as part of the total length of s.
Input:
Just a string of arbitrary length (can be empty).
Output:
The same string, but with its length appended to the end.  The characters that represent the length should also be counted as part of the length.  In cases where there are multiple valid lengths to append, choose the smallest one possible (see test cases for examples).
Test Cases:
INPUT     -> OUTPUT       // Comment
aaa       -> aaa4
          -> 1            // Empty string
aaaaaaaa  -> aaaaaaaa9    // aaaaaaaa10 would also normally be valid, but violates using the smallest number rule mentioned above
aaaaaaaaa -> aaaaaaaaa11
a1        -> a13          // Input can contain numbers at the end of the string, you do not have to handle the fact that it looks like 13 rather than 3.

Longer test case(s):

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa101
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa102

Rules:
This is code-golf, so shortest code in bytes wins.  Standard loopholes are forbidden.  Submissions may be an entire program or a function, and you may either print the result to stdout or return it as a variable from a function.

What characters can appear in the input?

@MartinEnder Alphanumerical characters only, 0-9 and A-Z/a-z.  So yes, you can have strings with numbers at the end.  I'll add a test case for one.

Pyth - 7 bytes
+Qfql+Q

Try it online here.

JavaScript (ES6), 32 bytes
f=(s,n=0)=>(s+n)[n]?f(s,n+1):s+n

How it works
f = (s, n = 0) =>   // given a string 's' and starting with n = 0:
  (s + n)[n] ?      // if the Nth character of (s + n) exists:
    f(s, n + 1)     //   try again with n + 1
  :                 // else
    s + n           //   return s + n

Starting with N=0, we test the Nth character (0-based) of the string made of the concatenation of the original input string and the decimal representation of N. We increment N until this character doesn't exist anymore.
Example:
N =  0 : abcdefghi0
         ^
N =  1 : abcdefghi1
          ^
N =  2 : abcdefghi2
           ^
...
N =  8 : abcdefghi8
                 ^
N =  9 : abcdefghi9
                  ^
N = 10 : abcdefghi10
                   ^
N = 11 : abcdefghi11    -> success
                    ^

Test cases

f=(s,n=0)=>(s+n)[n]?f(s,n+1):s+n

console.log(f("aaa"));       // -> aaa4
console.log(f(""));          // -> 1
console.log(f("aaaaaaaa"));  // -> aaaaaaaa9
console.log(f("aaaaaaaaa")); // -> aaaaaaaaa11
console.log(f("a1"));        // -> a13

Wow, JS is much terser than Python for this.

@Arnauld I cannot get my head around this. Do you mind explaining how this code works?

LaTeX, 108/171
\newcounter{c}\def\s#1#2]{\stepcounter{c}\def\t{#2}\ifx\empty\t\arabic{c}\else#1\s#2]\fi}\def\q[#1]{\s#10]}

\q[] //1

Whoa, I don't think I've ever seen a latex answer on ppcg before.

JavaScript (ES6), 37 bytes

f=(s,t=s,u=s+t.length)=>t==u?t:f(s,u)
<input oninput=o.textContent=f(this.value)><pre id=o>

When I clicked on Run Code Snippet I get to see an error message. I have no knowledge of Javascript - I was just trying

@Prasanna Works for me in Firefox; which browser are you using?

@Prasanna Works on latest Google Chrome. Are you sure you aren't using IE11 or older, Opera or anything that doesn't support ES6?

I'm using an old good chrome (Version 48.0.2564.97). I will try this with IE too. Can't update my chrome - office security issues

Lua 5.2, 32 Bytes
a=arg[1]print(a..#a+#(''..#a+1))

Where the variable a is the input string.

C, 67 65 61 bytes
x;f(*v){printf("%d",(int)log10(x=-~printf(v))*-~(x%10>8)+x);}

Wandbox

Ohh, yeah, I shoulda printf'd... Anyways, congrats on having the shorter C solution :D +1

Mathematica, 57 bytes
#<>ToString[(a=Length@#)+(i=IntegerLength)[a+i@a]~Max~1]&

Unnamed function taking an array of characters as input and returning a string. Uses the fact that if a is the length of the input, then the number to append to the input is a plus the number of digits in (a + the length of a), rather than just a plus the number of digits of a. Unfortunately it wouldn't give the right answer for the empty-string input without the ~Max~1 special case.

Pyke, 8 bytes (old version)
.f+liq)+

Explanation:
.f    )  -  first where (i++)
  +      -    input + i
   l     -    len(^)
    iq   -   ^ == i
       + - input + ^

Try it here! (New version, 9 bytes)

It always confuses me how buried the actual output is among warnings or other messages :-)

I should really get around to fixing the web bug in the copy link that automatically disables the warnings switch

Python 2, 54 48 46 bytes
Simple solution. Recursion ended up being shorter.
f=lambda s,n=0:f(s,n+1)if(s+`n`)[n:]else s+`n`

Try it online

I think you can do (s+`n`)[n:] for n<len(s+`n`).

Haskell, 46 bytes
f s=[l|i<-[0..],l<-[s++show i],length l==i]!!0

Usage example: f "aaaaaaaa" -> "aaaaaaaa9".
Simply try all numbers starting with 0 and take the first that fits.

Brachylog, 13 bytes
l<L$@:?rc.lL,

Try it online!
Explanation
Basically a description of the problem. It will try every value of L bigger than the length of the input until it finds one for which, when concatenated to the input, is the length of that concatenation.
l<L              length(Input) < L
  L$@            Convert L to a string
     :?rc.       The Output is the concatenation of the Input with L as string
         .lL,    The length of the Output is L itself

Brainfuck, 258 bytes
,>+<----------[++++++++++>+[>+<-],----------]<[<]>[.>]>>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]

The input must be terminated by a linefeed (LF). Only works for inputs with a length lesser than 256 (including the LF).
Try it online!
Explanation
# read first char and add one to cell #1
# the cell after the input will contain the length
,>+<
# subtract 10 to check for LF
----------
# while the input is not 10 (LF)
[
# restore the input to its original value
++++++++++
# add one to the length
>+
# cut and paste the length to the next cell, then read the input
[>+<-],
# subtract 10 to check for LF
----------
]
# for input abc, the tape here would be: a b c *0* 4
# rewind to the beginning of the input
<[<]>
# print the input string
[.>]>
# convert the length to ascii chars and output them
>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-
<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++
<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]

Note: I used code from this SO answer to convert the length to ascii output; I hope this is acceptable on PPCG. This is my first Codegolf submission, and my second BF program. Feedback is welcomed.

This isn't valid then, it must pass all test cases

So supporting a length up to 999 would be enough?

The spec says "arbitrary length" which means "as long as your language is capable of handling or without running out of memory"

The brainfuck interpreter you're using has 8-bit cells, so as long as your algorithm works for strings of arbitrary length, it should be fine if it fails for strings of length 256 or higher. The C and JavaScript submissions will also fail once the strings get too long.

Thank you Dennis, I will modify my submission accordingly

I modified the submission, hopefully it is valid now. Is it acceptable to "borrow" code from an SO answer like I did here?

Perl 6,  46  35 bytes
{$_~(.chars,*.chars+.chars...{$^a==$^b})[*-1]}

{$_~(.chars,*.chars+.chars...*)[2]}

Try it
Expanded:
{   # bare block lambda with implicit parameter ｢$_｣

  $_  # the input

  ~   # concatenated with

  (  # sequence generator

    .chars,  # the number of chars in ｢$_｣ (seed the generator)

    *\      # Whatever lambda input (represents previous value)
    .chars  # number of chars in that
    +       # plus
    .chars  # the number of chars in ｢$_｣

    ...     # keep doing that until

    *       # indefinitely

  )[2] # get the value at index 2 of the sequence
}

Python, 39 bytes
lambda a:eval('a+str(len('*3+'a))))))')

Longer form:
lambda a:a+str(len(a+str(len(a+str(len(a))))))

Iteratively in Python 2 (41 bytes):
x=a=input();exec"x=a+`len(x)`;"*3;print x

Starting with x as the input string a, applies the transformation x -> a + str(len(x)) three times. I'm still not clear why three applications are needed to always reach the fixed point.

Why 3 times? First to append the length of text, second to adjust the length to include the number, third in case that adjustment added an extra digit.

Retina, 22 bytes
\G`
.
x
+r`\d*$
$._
x

Try it online!
Ah well, if it wasn't for digits appearing in the input, this would be merely 11 bytes:
+r`\d*$
$._

Haskell, 61 60 bytes
e=length
l%n|s<-show$l+1,n>e s=s|m<-n+1=(l+1)%m
c s=s++e s%2

Try it online!
Recursive solution. Usage:
Prelude> c "aaaaaaaaa"
"aaaaaaaaa11"

Ruby, 62 58 56 bytes
s=gets.chomp;p s+"#{(s+"#{(s+"#{s.size}").size}").size}"

Tested in irb.
There's probably a better way to do this, but this was the first thing I came up with. Any help in golfing would be appreciated.
edit: I realized my use of parentheses was excessive.

You only use l in one place. If you inline that, you will save 3 bytes l=;. But your solution will still be longer than mine ;)

PHP, 42 bytes
while(++$n<strlen($a=$argv[1].$n));echo$a;

Run with -r. Test at OnlinePHPfunctions.

bash, 47 bytes
 for((n=-1;${#s} != $n;));{ s=$1$[++n];};echo $s

Save this as a script, and pass the input string as an argument.
It's a brute force implementation: try each number in turn until you find one which works.

05AB1E, 11 bytes
[¹¾JDg¾Q#¼\

Pretty straightforward bruteforce:
            Implicit i = 0
[           while true
 ¹¾J        Concatenate input and i -> str
    Dg¾Q#   Break if length(str) == i
         ¼\ Else, i += 1

Try it online!

><> (Fish) 35 bytes
i:1+?!v:o
ln;v9l<  >
*9+>:&)?!^1l&a

Takes input onto the stack, checks the length against values 9,99,999... and if the length is larger than add 1 to the stack length.

Ruby, 43 36 bytes
Anonymous function, abusing the $. global.
->s{$.+=1while(t=s+"#$.").size>$.;t}

Call it like this:
f = ->s{$.+=1while(t=s+"#$.").size>$.;t}
f[""]          # => "1"
f["a"]         # => "a2"
f["aaaaaaa"]   # => "aaaaaaa8"
f["aaaaaaaa"]  # => "aaaaaaaa9"
f["aaaaaaaaa"] # => "aaaaaaaaa11"

Vyxal, 6 bytes
LJL+LJ

Try it Online!
Append the length of the string, take the length of that, then append the new length to the original. This does work with digit overflows (9, 99, etc...).

There's probably something I can do with iteratively adding and appending lengths until they are the same....

The code looks especially funny if you change the + to an J, which works fine: LJLJLJ

You actually don't need the Ṡ flag.

3(LJ for 4 bytes

oh..... but mine is funnier :p

Pip, 8 bytes
L3Ya.#yy

Try It Online!
Explanation
Inspired by Pacmanboss256's Vyxal solution.
          ;; y is empty string; a is first command-line argument (implicit)
L3        ;; Loop 3 times:
   a.     ;;  Concatenate a with
     #y   ;;  Length of y
  Y       ;;  Assign the result to y
       y  ;; After the loop, output y

Some worked examples:
Input a        ""    "aaa"    "aaaaaaaaa"
Original y     ""    ""       ""
After loop 1   "0"   "aaa0"   "aaaaaaaaa0"
After loop 2   "1"   "aaa4"   "aaaaaaaaa10"
After loop 3   "1"   "aaa4"   "aaaaaaaaa11"

+1, neat loop setup

K (ngn/k), 31 bytes
{$[9>t:#x;x,$1+t;x,$#x,($1+t)]}

Try it online!
+22 bytes thanks to Dominic van Essen for pointing out a not-working test case (that should have worked)

I think this fails for "aaaaaaaaa": it outputs "aaaaaaaaa10" which is 11 characters long...

@DominicvanEssen ohhhhhhhh... now I understand why.

fails for the longer test cases (i.e. you dont handle strings of length 99+)

{x,$#x,$#x,$#x} for 15 bytes i think?

{{y,$#x}/4#,x} for 14 bytes, maybe golfable further?

MATL, 11 bytes
`G@Vhtn@>]&

Try it online! Or verify all test cases.
`      % Do...while
  G    %   Push input
  @    %   Push iteration index (1-based)
  V    %   Convert number to string
  h    %   Concatenate horizontally
  t    %   Duplicate
  n    %   Get length of concatenated string
  @    %   Push iteration index
  >    %   True if length of concatenated string exceeds iteration index
]      % End. Run next iteration if top of stack is true; else exit loop
&      % Specifiy that next function (implicit display) takes only one input
       % Implicitly display top of the stack. This is the concatenated string
       % that had a length equal to the iteration index

C#, 77 bytes
n=>{int a=n.Length;int c=(a+1).ToString().Length-1;return(n+(n.Length+1+c));}

I don't now C#, but couldn't you use return(n+(a+1+c)) as a=n.Length ?

And also drop the -1 from int c=(a+1).ToString().Length-1 and the +1 from the return?

Wait, does this handle the larger test cases correctly? It looks like it returns aa...a100 instead of aa...a101 for the 99a test case.

Ruby, 51 bytes (program)
Ruby, 49 bytes (function)
Program (last newline is not necessary and thus unscored):
x=gets.strip
i=0
i+=1 until(y=x+i.to_s).size==i
p y

Function (last newline is scored):
def f x
i=0
i+=1 until(y=x+i.to_s).size==i
y
end

R, 49 bytes
cat(a<-scan(,""),(t<-nchar(a))+nchar(t+1),sep='')

Pretty straightforward solution.

This doesn't work for me: Read 1 item Error in nchar(x + 1) : object 'x' not found. I found that (t<-nchar(a))+... did work.

@JarkoDubbeldam : My bad !

Factor, 55 bytes
It's a walk in the park! I came up with this in my head as soon as I read the question.
[ dup length dup log10 ⌈ + >integer 10 >base append ]

Wolfram, 56
#<>ToString@Nest[l+IntegerLength@#&,l=StringLength@#,2]&

Given l = StringLength[x] it appends l + IntegerLength[l + IntegerLength[l]] to x.

Labyrinth, 48 45 41 bytes
)"   10/{:@!
.,;: _ { _ ;
   })"}) 10-9!@

Try it online!
Saved 4 bytes thanked to @Martin Ender

Clojure, 72 bytes
(defn f([s](f s 1))([s n](if(=(count(str s n))n)(str s n)(f s(inc n)))))

ForceLang, 83 bytes
set s io.readln()
label 1
set n 1+n
set t s+n
if t.len=n
 io.write t
 exit()
goto 1

awk, 37 bytes
{FS="";r=$0;$0=r NF;$0=r NF;$0=r NF}1

That will work in any awk that splits lines into characters when FS is NULL e.g. GNU awk and most others. WIth other awks you'd have to use the length() function instead of NF to calculate the number of characters in the record, e.g. awk '{r=$0;$0=r length;$0=r length;$0=r length}1' file.
Breakdown:
FS=""    # split the record at every character so NF is a count of characters in the record
r=$0     # save the original record
$0=r NF  # append the original length to the original record and cause awk to recalculate NF
$0=r NF  # append the new length to the original record and cause awk to recalculate NF again
$0=r NF  # append the final length to the original record for output
1        # a true condition invoking awks default action of printing the current record

Example:
$ awk '{FS="";r=$0;$0=r NF;$0=r NF;$0=r NF}1' file
aaa4
1
aaaaaaaa9
aaaaaaaaa11
a13
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa101
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa102

Jelly, 12 bytes
Many thanks to Dennis for his help in writing this answer. Golfing suggestions welcome. Try it online!
D;³L=
LÇ1#;@

Explanation
LÇ1#;@  Main link. Argument: s
          Runs the helper link until a suitable x is found.
L       Yields the length of s.
 Ç1#    Calls the helper link until one match is found.
    ;@  Appends the matching x to s.

D;³L=  Helper link. Argument: x
         Appends x to s and checks if its length is equal to x.
D      Convert x from integer to decimal.
 ;³    Append to our original string.
   L=  Check if the length of this new string is equal to x.

Perl, 31 bytes
Just going through all the numbers until one fits:
perl -lpe '1while++$n<length$_.$n;$_.=$n'

Factor, 47 bytes
[ dup length dup log10 ⌈ + 1 /i >dec append ]

Attempt This Online!
small improvement to the previous answer.
>dec is polyfilled since it is a newer addition.

Ly, 26 14 bytes
iysp&ol`Syl+u;

Try it online!
This turned out to be trickier than I expected...  Since strings of length 9, 99, etc... need an extra digit when the length it appended.
So the code computes the number of digits in the length of a string composed of the original string plus the length of that string.  Then that length is added to the length of the original string to get the final length, which is appended to the original.
iysp&ol`Syl+u; -
i              - read in the input string
 ysp           - get the length, stash it, delete from stack
    &o         - print the string
      l`       - load the string length and increment
        Sy     - split to digit, count them
          l+   - load the string length and add to digit count
            u; - print as number and exit (to avoid printing stack)

jq, 40 bytes
.+"\(length+(length+1|tostring|length))"

Try it online!
It's the same algorithm, just in jq for comparison.  I couldn't find a shorter way to do it in jq even though using "length" three times seems like it should be golf-able...

Thunno 2, 4 bytes
3{l+

Try it online!
Explanation
3{l+  # Implicit input
3{    # Repeat three times:
  l   #  Take the length of the top
      #  of stack (initially input)
   +  #  And append this to the input
      # (Three times is enough to handle
      #  digit overflows like 9, 99, etc.)
      # Implicit output

Under review
Powershell V2.0, 64 bytes
$s=$args[0]
$s+[string]($s.length+([string]($s.length)).length)

Example
PS C:\Users\***\Downloads\golf> .\str-length.ps1 'This is my strin3333333333333333333333333333333333333333333333333333
33333333333333333333333333333333333333333g'
This is my strin333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333g113

This outputs aaaaaaaaa10 when given input aaaaaaaaa, and not the correct aaaaaaaaa11.

You're right, I missed that somehow.

C, 75 bytes
Yes, there's another C answer but this (the same method as my Factor answer) is shorter:
i,z;f(char*s){i=strlen(s);z=1+log10(i);sprintf(realloc(s,i+z)+i,"%d",i+z);}

Ungolfed:
i, z;

g (char* s){
  i = strlen(s);
  z = 1 + log10(i);
  s = realloc(s, i + z);
  sprintf(s + i, "%d", i + z);
}

ceil(log10(n) is the number of digits in base 10 n, but 1+ is shorter than ceil().
Then, resize the string so we don't get a segfault, and format the number after the string part.

I don't believe this method works for 98 or 997

Scala, 75 bytes
def a(b:String,c:Int=0):String=if((b+c).length>c)a(b,c+1)else b+c

awk, 27 bytes
$0=$0length($0length($0NF))

Test it:
$ awk -F '' '$0=$0length($0length($0NF))' file
7aaaaaa8
8aaaaaaa9
9aaaaaaaa11
97aaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa99
98aaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa10aaaaaaaa101

You can change length($0) to just length for brevity.

@EdMorton Been experimenting with awk -F '' '$0=NF'

C# / CS Script 99 87 79 bytes
Saved a few bytes switching to a lambda.
And a few more moving the try/catch out of the for loop.
F=a=>{int i=0,l;try{for(;;)l=(a+(a+a.Length).Length)[++i];}catch{}return a+i;};

Try it here
Expanded:
F => a
{
    // 'i' is for traversing the string
    // 'l' is just a placeholder
    int i = 0, l;

    // wrap the loop in a try/catch
    try
    {
        // loop forever
        for (;;)
            // assign to 'l' the char at position ++i
            // throws an IndexOutOfRangeException when it falls off the end
            l = (a + (a + a.Length).Length)[++i];
    }
    // empty catch block
    catch {}

    // returns a string concat of the input a and index i
    return a + i;
}

Java 7, 67 bytes
String y(String y){int i=0;for(;(y+i).length()!=i;i++);return y+i;}

Try it online!

JavaScript, 29 bytes
s=>(g=x=>s+x.length)(g(g(s)))

Try it online!

05AB1E, 4 bytes
3Fg«

Try it online or verify all test cases.
Explanation:
3F    # Loop 3 times:
  g   #  Pop the current string, and push its length
      #  (which will use the implicit input-string in the first iteration)
   «  #  Append this length to the (implicit) input-string
      # (after which the result is output implicitly)

This looks suspiciously similar to a port of @lyxal's comment.

@Neil Your link goes to the question itself instead of a comment? But looking for Lyxal's comment I assume you mean this one on the Vyxal answer? It indeed appears to be the same, even though I came up with it independently a few hours ago. It's a pretty straight-forward approach when you use g« twice in a row and see that the 98-long test case requires a third g« tbh.

Huh, your comment doesn't work for me, but I'll take your word for both your claims.

@Neil Huh? Your linked comment didn't work for me though.. :/


text:
Put the Hat On the Cat
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 AEIOUaeiouare 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 so the shortest code wins

"at random (or the closest that your language has)" so if my language has no random commands I can just do something deterministic???

@LuisMendo better?

@Fatalize not even get the current time random?

@Rod I don't have any language in mind. I'm just saying that you have to impose that it is random (and what kind of random) otherwise it makes no sense at all.

The specs say we have to add ^ ´ or backtick, but the example tschuss shows an umlaut. Are umlauts required or not?

@LevelRiverSt no, the tschüss examples show that the ü won't be modified, because it already have an accent

Indeed! Clearer now

Are there any constraints on Unicode normalization of the input? A naive algorithm will see an NFC word like tschüss as having an accented u, but an NFD word like tschüss as having a non-accented u, and yet the two look identical. Likewise, are there constraints on Unicode normalization of the ouptut? (I'd imagine NFD output would be shorter in bytes to generate.)

Are the "words" always separated by a single space? (where &  counts as a word)

@BradGilbertb2gills yes

Must the randomness of choosing the vowel and choosing the hat be independent?

@MatthewJensen yep

Perl 6, 101 bytes
~*.words.map: {(my$p=m:ex:i/<[aeiou]>/».to.pick)~~Mu:D??~S/.**{$p}<(/{("\x300".."\x302").pick}/!!$_}

Try it
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
}

Vyxal S, 27 bytes
⌈:ƛAT:[℅|u];Zƛ÷›[nt3℅767+CṀ

Try it Online!
The result of my older answer mixed with emanresu A's answer.
Vyxal S, 37 35 33 bytes
⌈:ƛ≬k∨$cḟ:[℅|u];Zƛ÷›:[768:⇧ṡC℅Ṁ|_

Try it Online!
-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

768:›:›W => 768:⇧ṡ

JavaScript (Node.js), 118 bytes
Spec doesn't state what Unicode normalisation 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! 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!
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
  )
)

Slight typo in your explanation, you've got // add 63, should be 68

Ah, thank you! With the amount of transcribing numbers there's bound to be one that slipped through

Vyxal S, 17 bytes
⌈ƛAa[AT›℅3℅767+CṀ

Try it Online!
Some tricks stolen from Seggan's answer.
⌈ƛ                # 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

Fails: you must put a diacritic on every word

@Seggan Oops. One moment

That is, every word that has a vowel

@Seggan Hopefully fixed.

Yep. Time to retrofit my answer now lol

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
I really feels like I'm cheating, since I still add hats to already accented vowels created by combining characters. 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 or U+0301 or U+0302, 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]));

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.)

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
                             ]))

You do not need the space between import and *.

j+1 for can be j+1for.

Python 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!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/