title: JQuery - random .replace() error
body: <p>I have problem with random .replace(), it allways display same random number, i am trying to replace $random$ with a different random number.  </p>
  
  <pre><code>$(document).ready(function() {
    var arr = [
      '1',
      '2',
      '3',
      '4',
      '5',
      '6',
      '7',
      '8',
      '9',
      '10'
    ]
    $("#present-users").children('li.present-user').each(function() {
      arr.push($(this).find('img')[0].title);
    });
    var random = arr[Math.floor(Math.random() * arr.length)];
    var text = "$random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$ $random$".replace(/\$random\$/g, random);
    alert(text)
  });
  </code></pre>
  
  <p><strong><a href="https://jsfiddle.net/kxo60agm/" rel="nofollow">jsfiddle example</a></strong>  </p>
  
  <p>Thanks,
  Nikola</p>