Copyright © tutorialspoint.com

# PERL rand Function

## Syntax

rand EXPR rand

## 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

- Floating point number

## 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

Copyright © tutorialspoint.com