Копирование значения поля email в поле login до знака "@"

HTML

<input type="text" id="email" placeholder="email">
<input type="text" id="name">

JavaScript

function getRandomInt(min, max){
  return Math.floor(Math.random() * (max - min + 1)) + min;
}


$("#email").focusout(function(e){
  $("input#name").val( $(this).val().split("@")[0]  +  getRandomInt(1000,9999)   );
})