[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



#!/usr/bin/perl

$ITER = 20;
my $string = "";
for(my $i = 0; $i != $ITER; $i++) {
        $string = $string."".int(rand(9));
}

print $string;


On Fri, 2004-04-16 at 08:34, Christopher Fowler wrote:
> I want to create session ids to be stored as cookies for use in my PERL
> CGI programs.  The IDs will be store in SQLlite with a key into a table
> that lists all the name value pairs for that session.  What I want to do
> is randomly generate a 64bit number and then convert it into a hex
> string.  This string will be 128 characters long.  I will then set that
> string as the session id in the cookie and insert it into the table.
> 
> What is the best way to generate the number and convert to hex?
> 
> Thanks,
> Chris
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00569" href="msg00569.html">[ale] Perl random</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00567" href="msg00567.html">[ale] Perl random</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00567.html">[ale] Perl random</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00569.html">[ale] Perl random</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00567.html">[ale] Perl random</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00569.html">[ale] Perl random</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00568"><strong>Date</strong></a></li>
<li><a href="threads.html#00568"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>