Randomly generate spelling mistake in string
Break it down into one function that randomly repeats a character, and another function which randomly executes that function 50% of the time:

function repeatRandomChar(str) {
  var i = Math.floor(Math.random() * str.length);
  return str.slice(0, i+1) + str.slice(i);
}

function randomTypo(str) {
  return Math.random() &gt; 0.5 ? repeatRandomChar(str) : str;
}


Now you can just call randomTypo('Stack Overflow') 10 times to reproduce your sample data.

Note also that the original code has needless multiplication, in that

 Math.random() &gt; 0.5 


is equivalent to:

 (Math.random() * 10) &gt;= 5