Does shuffle() function makes query faster?
<p>I have two tables with more than 150000 rows of numbers, and I have this code:</p>

<pre><code>$q=$_GET["q"];
$negative = strlen($q);
$reverse = strrev($q);
while ($a = mysql_fetch_array($sql)) {
if (strlen($q) &gt; 0)
  {
  $hint="";
  for($i=0; $i&lt;count($a); $i++)
    {
    if ($reverse==substr($a[$i],-$negative,strlen($q)))
      {
      if ($hint=="")
        {
        $hint=$a[$i];
        }
      }
    }
  }
echo $hint . "\t";
}
</code></pre>

<p>This query takes 27 seconds to return the results, and I wanted to shuffle all the results, but when I added shuffle() function like this:</p>

<pre><code>while ($a = mysql_fetch_array($sql)) {
shuffle($a);
</code></pre>

<p>The performance changed amazingly, now it takes only two seconds to return the results, and I have tried many times it's the same.
Does it make faster?</p>
