Sunday, March 4, 2018

Number seed() Method


Number seed() Method in Python 3:

Description
The seed() method initializes the basic random number generator. Call this function before calling any other random module function.
Syntax
Following is the syntax for the seed() method
import random
seed([x], [y])

Note: This function initializes the basic random number generator.
Parameters
· x - This is the seed for the next random number. If omitted, then it takes system time to generate the next random number. If x is an int, it is used directly.
· Y - This is version number (default is 2). str, byte or byte array object gets
converted in int. Version 1 used hash() of x.
Return Value
This method does not return any value.

Example
The following example shows the usage of the seed() method.





When we run above program, it produces following result-