Randomness is added to programs by using random numbers. These are generated by random number functions.
Python has a package called random.
Two of the functions it provides are:
Returns a random floating point number between 0 and 1.
Returns a random floating point number between a and b.