random module in python

Random module in Python Full tutorial | Python Bootcamp


In this post, you will learn about the random module and see an example of a random module and below is the video format of the post.


What is random module ❓

Python Random module is an in-built module of Python which is used to generate random numbers. These are pseudo-random numbers means these are not truly random.

This module can be used to perform random actions such as generating random numbers, print () random a value for a list or string, etc…

With the random module, you can use many functions like ????????

  1. seed (): Initialize the random number generator
  2. randint(): Returns a random integer within the range
  3. choices(): Returns multiple random elements from the list with replacement
  4. random(): Generate random floating numbers
  5. uniform(): Return random floating number between two numbers both inclusive
  6. triangular(): Return a random floating point number within a range with a bias towards one extreme
  7. gauss(): Return a random floating point number with Gaussian distribution
  8. normalvariate(): Return a random floating point number with normal distribution

There are still many functions that can combine with the random module.

How to use random module ????????

Below is a examples of the random modules and I am sure if you try the below example you will be familiar with the random module and some functions like randint…


As I said random module is built in python, you just need to enter import random and then we add a list of numbers in a variable and then finally I have added random.choice.

Random.choice will automatically choose the numbers in variables and print the value.


Random module

Also, you can use other functions with random modules to make more different results. Above is the video format of the post, check it out ☝????

Read: Celsius to Fahrenheit in python full tutorial | Python

Also Read: Kilometer to miles in python full tutorial

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions or brave browser to block ads. Please support us by disabling these ads blocker.Our website is made possible by displaying Ads hope you whitelist our site. We use very minimal Ads in our site


Scroll to Top