next number in sequence based upon one or more past numbers that it has generated indeeda simple yet popular pseudo-random number generator chooses its next number based solely on the most recently chosen number and some additional parameters using the following formula next ( *current bnwhere aband are appropriately chosen integers python uses more advanced technique known as mersenne twister it turns out that the sequences generated by these techniques can be proven to be statistically uniformwhich is usually good enough for most applications requiring random numberssuch as games for applicationssuch as computer security settingswhere one needs unpredictable random sequencesthis kind of formula should not be used insteadone should ideally sample from source that is actually randomsuch as radio static coming from outer space since the next number in pseudo-random generator is determined by the previous number( )such generator always needs place to startwhich is called its seed the sequence of numbers generated for given seed will always be the same one common trick to get different sequence each time program is run is to use seed that will be different for each run for examplewe could use some timed input from user or the current system time in milliseconds python' random module provides support for pseudo-random number generation by defining random classinstances of that class serve as generators with independent state this allows different aspects of program to rely on their own pseudo-random number generatorso that calls to one generator do not affect the sequence of numbers produced by another for convenienceall of the methods supported by the random class are also supported as stand-alone functions of the random module (essentially using single generator instance for all top-level callssyntax seed(hashablerandomrandint( ,brandrange(startstopstepchoice(seqshuffle(seqdescription initializes the pseudo-random number generator based upon the hash value of the parameter returns pseudo-random floating-point value in the interval [ returns pseudo-random integer in the closed interval [abreturns pseudo-random integer in the standard python range indicated by the parameters returns an element of the given sequence chosen pseudo-randomly reorders the elements of the given sequence pseudo-randomly table methods supported by instances of the random classand as top-level functions of the random module