|more useful options|
what does rand return?by si_lence (Chaplain)
|on Nov 30, 2005 at 11:17 UTC||Need Help??|
si_lence has asked for the
wisdom of the Perl Monks concerning the following question:
I came across a (at least to me) unexpected behaviour of the rand function. If I use my $num = rand; I get back numbers like 863651.70263671, 1592604.921875, 1865907.1796875, 29093.6875.
Now I know that I should have called it as my $num = rand(10); but I was surprised that it a) works (even under strict) and b) what values I got back.
Can somebody please explain to me what happens here? perldoc -f rand did not help