Random module in Python 3

In Python number method random () return a random float r such as 0 less than or equal to R and R is less than 1. Python offer the easy toolkit used to handle random numbers. The module used for these random numbers are “random”. It is also called as pseudo random generator.  It will contain the method that directly solves many programming issues. This module is based on the popular algorithm called default pseudo random number generator for python as well as Microsoft excel, php, etc.  If we want to make the password more secure we need the random page of website. To pick up a random number in given range we need computer. The random elements can be picked up as pick the random card from the deck, etc.

Random module Syntax is:-

Random ()

Use of random module:-

Import random
Print (“printing random numbers using random. Random ()”)
Print (random. Random ())
O/p:-
Printing random numbers using the random. Random ()
0.5015127958234789
The python random module function will depend on pseudo random number generator function random ().
Random.random():- 
 It will generate random float number between 0.0 to 0.1 and the functions don’t need any arguments. 
random.randint():-
The function returns a random integer value between the specified integers.
Example:-
Import
random.radint (1,100)
95
random.radint (1,100)
49
random.randrange():-
The function returns a randomly selected element from the range which created by the start, stop, and step arguments.
Value of start is 0 by default.
Random. range(1,10)
2
Random.range(1,10,2)
5
Random.range(0,101,10)
80
Random. Choice():-
This function will return a randomly selected element from the non-empty sequence.
Import
Random.choice(‘computer’)
‘t’
Random.choice([12,23,23])
34
Random.choice([12,23,23])
12
random.Shuffle():-
This function randomly reorders the elements in the list.
Numbers=[12,34,55,66,55]
Random.shuffle(numbers)
[55,       12,    34,    66,    55]
Random.shuffle(numbers)
[55, 34,66, 12, 55]

Additional Services : Refurbished Laptops Sales, Python Classes, Share Market Classes And SEO Freelancer in Pune, India