FUNCTIONS
choice(seq) method of Random instance
Choose a random element from a non-empty sequence.
randint(a, b) method of Random instance
Return random integer in range [a, b], including both end points.
random(...) method of Random instance
random() -> x in the interval [0, 1).
randrange(start, stop=None, step=1, _int=<class 'int'>) methodofRandominstanceChoosearandomitemfromrange(start, stop[, step]).
Thisfixestheproblemwithrandint()whichincludestheendpoint; inPythonthisisusuallynotwhatyouwant.
sample(population, k)methodofRandominstanceChooseskuniquerandomelementsfromapopulationsequenceorset.
Returnsanewlistcontainingelementsfromthepopulationwhileleavingtheoriginalpopulationunchanged. Theresultinglistisinselectionordersothatallsub-sliceswillalsobevalidrandomsamples. Thisallowsrafflewinners(the sample)tobepartitionedintograndprizeandsecondplacewinners(the subslices).
Membersofthepopulationneednotbehashableorunique. Ifthepopulationcontainsrepeats, theneachoccurrenceisapossibleselectioninthesample.
Tochooseasampleinarangeofintegers, userangeasanargument.
Thisisespeciallyfastandspaceefficientforsamplingfromalargepopulation: sample(range(10000000), 60)
seed(a=None, version=2) method of Random instance
Initialize internal state from hashable object.
Noneor no argument seeds from current time orfrom an operating
system specific randomness source if available.
For version 2 (the default), all of the bits are used if *a* is a str,
bytes, or bytearray. For version 1, the hash() of *a* is used instead.
If *a* is an int, all bits are used.
shuffle(x, random=None) method of Random instance
Shuffle list x in place, andreturnNone.
Optional argument random is a 0-argument function returning a
random float in [0.0, 1.0); if it is the default None, the
standard random.random will be used.
uniform(a, b) method of Random instance
Get a random number in the range [a, b) or [a, b] depending on rounding.