Intro to the Python Random Module

python_tutorials

Introduction

Even for someone not interested in computer programming, the usefulness of generating random numbers in certain circumstances is something obvious. In most board games we throw dice to generate an unpredictable number that defines the player’s next move. Also, we can all agree that playing any card game would be pointless without a proper shuffle between rounds.

But random numbers are not only important in relatively trivial fields like entertainment or gambling. They’re especially crucial in the field of cryptography. In order to ensure safe transmission of data, every time a secure connection is necessary, a random key has to be generated. Many different kinds of electronic communication use this kind of security. It’s very important for the key to be difficult to guess – the best way to ensure that is by making it random since the moment someone guesses the key, they are able to decipher the message – and the communication is not secure anymore.

True Randomness vs Pseudo-randomness

Random numbers can be obtained as a result of applying methods called random number generators (RNG), which can be divided into two categories: true random-number generators (TRNGs – also called hardware random number generators)

To finish reading, please visit source site