|
|
| more useful options | |
| PerlMonks |
what does rand[] return?by si_lence (Chaplain) |
| on Nov 30, 2005 at 11:17 UTC ( #512902=perlquestion: print w/ replies, xml ) | Need Help?? |
|
si_lence has asked for the
wisdom of the Perl Monks concerning the following question:
Dear Monks
I came across a (at least to me) unexpected behaviour of the rand function. If I use my $num = rand[10]; 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 Thanks si_lence
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||