math there are bunch of other distributions that you can use the most common is the uniform distributionin which all values in range are equally likely for instancerandom uniform( , see the python documentation [ for information on the other distributions more random randint function one way to generate cryptographically safe random numbers is to use some fairly random physical process examples include radioactive decayatmospheric phenomenaand the behavior of certain electric circuits the os module has function urandom that generates random numbers from physical process whose exact nature depends on your system the urandom function takes one argument telling it how many bytes of random data to produce calling urandom( produces one byte of datawhich we can translate to an integer between and calling urandom( produces two bytes of datatranslating to integers between and here is function that behaves like randintbut uses urandom to give us nondeterministic random numbersfrom os import urandom from math import log def urandint( , ) urandom(int(log( - + )/log( ))+ total for ( ,yin enumerate( )total + *( **ireturn total%( - + )+ the way this works is we first have to determine how many bytes of random data to generate since one byte gives possible values and two bytes give possible valuesetc we compute the log base of the size of the range - + to determine how many byes to generate we then loop through the bytes generated and convert them to an integer finallymodding that integer by - + reduces that integer to number between and - + and adding to that produces an integer in the desired range miscellaneous topics hexadecimaloctaland binary python has built-in functions hexoctand bin for converting integers to hexadecimaloctaland binary the int function converts those bases to base here are some exampleshex( oct( bin( int( xfa' xfa