title: Generate random number % 10 == 0
body: <p>I'm writing a simple game and I have a problem with generating values. I need to generate a number between 1 and 500, but only in the form of 10, 20, 30, 40, 50 etc. I have written such a function, but the numbers adjust once for an average of 100 page refreshments. How can I do this?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log(generatePosition());
  
  function generatePosition() {
      var x = Math.floor(Math.random() * 500) + 1;
      var y = Math.floor(Math.random() * 500) + 1;
     
      if (x % 10 == 0 &amp;&amp; x % 10 == 0) {
          var cords = [x, y];
      }
     
      return cords;
  }</code></pre>
  </div>
  </div>
  </p>