Copyright © tutorialspoint.com

# Python Number seed() Function

## Description:

This function sets the integer starting value used in generating random numbers. Call this function before calling any other random module function.

## Syntax:

    seed ( [x] )

Note: This function is not accessible directly so we need to import seed module and then we need to call this function using random static object.

## Parameters:

Here is the detail of parameters:

- x: This is the seed for the next random number. If ommited then it takes system time to generate next random number.

## Return Value:

Returns None.

## Example:

    #!/usr/bin/python
    import random

    random.seed( 10 )
    print "Random number with seed 10 : ", random.random()

    # It will generate same random number
    random.seed( 10 )
    print "Random number with seed 10 : ", random.random()

    # It will generate same random number
    random.seed( 10 )
    print "Random number with seed 10 : ", random.random()

This will produce following result:

    Random number with seed 10 :  0.57140259469
    Random number with seed 10 :  0.57140259469
    Random number with seed 10 :  0.57140259469

Copyright © tutorialspoint.com