Tech Study

Python Random Module | Python random number

Python random number – Python has defined a set of functions or methods that are used to generate or modify random numbers through the random module. Functions in the random module trust a pseudo-random number generator function random(), which creates or generates a random float number between 0.0 and 1.0. These specific type of functions is used in a lot of games, lotteries, or any application that requires a random number generation.


import random



For example – 

import random




Note that we can get different outputs because this program generates a random number in the range of 0 and 9. The syntax of this function is:


Following are the different ways to generate random numbers:

  1. choice()
  2. randrange(beg,end,step)
  3. seed()
  4. shuffle()
  5. uniform()

The pseudo-random numbers that the random module generates are not cryptographically secure or safe. Python uses the Mersenne Twister algorithm for creating or generating random numbers. But this algorithm is completely deterministic, making it a very unsuitable choice for cryptographic purposes.

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more