http://qs1969.pair.com?node_id=1184397

msh210 has asked for the wisdom of the Perl Monks concerning the following question:

O Monks,

How can one generate a (pseudo)random number between 0 and 1, inclusive? I checked rand and the links it contains to other generators, as well as the Monastery's own search and Google, but all I've found is for random numbers in [0,1), not in [0,1]. Naturally, the probability of getting 1 is 0 anyway, so this has little practical use, but I'm curious.


Edit: It's pointed out below that the probability of getting 1 would not be 0. So I guess this is a practical question.

$_="msh210";$"=$\;@_=@{[split//,uc]}[2,0];$_="@_$\1";$\=$/;++$_[0]for$...1;print lc substr crypt($_,"@_"),1,6