Choose a random element from a nonempty sequence

Слайд 2

Choice

Choose a random element from a non-empty sequence.

Choice Choose a random element from a non-empty sequence.

Слайд 3

Choices

Return a k sized list of population elements chosen with replacement.
If

Choices Return a k sized list of population elements chosen with replacement.
the relative weights or cumulative weights are not specified,
the selections are made with equal probability.

Слайд 4

Randint

Return random integer in range [a, b], including both end points.

Randint Return random integer in range [a, b], including both end points.

Слайд 5

Randrange

Choose a random item from range(start, stop[, step]).
This fixes the problem

Randrange Choose a random item from range(start, stop[, step]). This fixes the
with randint() which includes the
endpoint; in Python this is usually not what you want.

Слайд 6

Random

random() -> x in the interval [0, 1).

Random random() -> x in the interval [0, 1).