Random Code Overkill?
<p>I have some code I am using</p>

<pre><code>function genCode ($entropy=1) {
    $truCde = "";
    $indx = 0;
    $leng = 30*$entropy;
    while ($indx &lt; $leng) {
        $code = "";
        $length = 100*$entropy;
        $index = 0;
        while ($index &lt; $length) {
            $code .= rand();
            $index++;
        }
        $index = 0;
        while ($index &lt; $length) {
            $code = sha1($code);
            $index++;
        }
        $truCde .= $code;
        $indx++;
    }
    $finalCode = sha1(rand()) . hash("sha256",$truCde . md5($entropy*rand()));
    $finalCode .= sha1(md5(strlen($finalCode)*$entropy));
    return hash (
        "sha256",
        sha1($finalCode) . sha1(md5($finalCode)) . sha1(sha1($finalCode))
    );
}
</code></pre>

<p>to generate a random code for e-mail verification. Is there code that takes less time to generate random codes. It takes about 1-2 seconds to run this code, but I am looking to shave .7 seconds off this because the rest of the script will take longer.</p>
