< Perl Programming < Keywords
![](../../../I/Crystal_Clear_action_apply.png.webp)
The code
The rand keyword
rand is a function that returns a random fractional number greater than or equal to 0 and less than the value of EXPRESSION. Without EXPRESSION, the value 1 is used so that the interval of the random number is .
Syntax
rand EXPRESSION
rand
Examples
![](../../../I/Crystal_Clear_action_apply.png.webp)
$a = rand(31);
print 'int(' . "$a" . ') = ', int($a);
returns a number [0, 31) like
int(28.7540893554688) = 28
See also
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.