title: How to get mysql random integer range?
body: <p>I am trying to generate a random integer for each row I select between 1 and 60 as timer.</p>
  
  <pre><code>SELECT downloads.date, products.*, (FLOOR(1 + RAND() * 60)) AS timer
  </code></pre>
  
  <p>I have searched and keep coming up to this FLOOR function as how to select a random integer in a range. This is giving me a 1 for every row.
  What am I missing?</p>
  
  <p>I am on mysql   5.0.75</p>
  
  <p>Heres the rest of the query I belive it might be a nesting issue</p>
  
  <pre><code>SELECT *
  FROM (
   SELECT downloads.date, products.*, FLOOR(1 + (RAND() * 60)) AS randomtimer, 
   (
   SELECT COUNT( * )
   FROM distros
   WHERE distros.product_id = products.product_id
   ) AS distro_count,
  
   (SELECT COUNT(*) FROM downloads WHERE downloads.product_id = products.product_id) AS true_downloads
  
   FROM downloads
   INNER JOIN products ON downloads.product_id = downloads.product_id
  ) AS count_table
  WHERE count_table.distro_count &gt; 0
  AND count_table.active = 1
  ORDER BY count_table.randomtimer , count_table.date DESC LIMIT 10
  </code></pre>