Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL rand Function
Syntax
Definition and Usage
Returns a random fractional number between 0 and the positive number EXPR, or 1 if not specified. Automatically calls srand to seed the random number generator unless it has already been called.
Return Value
Example
Try out following example:
#!/usr/bin/perl -w
# print a random number between 0 and 10.
print("Random Number:", rand(10), "\n");
|
It will produce following results:
Random Number:5.09158594141812
| |
|

|
|
|