1. Generate Random Numbers
Random.random () generates a random number before 0-1
Random.uniform (1,10) generates a random number in an interval range
Random.randint (3,9) generates an integer random number in an interval range
Random.choice (list or str or tunple) randomly selects an element in a sequence of lists, tuples, strings, etc.
Random.shuffle (a) randomly disrupts a sequence
Random.sample (a) randomly obtaining fragments of a specified length from a sequence
2. Generate UUID
UUID.UUID1 () timestamp-based
UUID3 ()--MD5 hash value based on name
By calculating the MD5 hash of the name and namespace, it is worthwhile to ensure the uniqueness of different names in the same namespace, and the uniqueness of different namespaces, but the same name of the same namespace produces the same UUID.
Uuid4 ()--based on random numbers
obtained by pseudo-random number, there is a certain repetition probability, the probability can be calculated.
Python Learning-Exercises 1 consolidation