Loading topic
random.sample on a list. The algorithms come in later chapters. T6 min readrandom.Random. It also assumes you are comfortable with binomial probabilities, and that you understand the stream constraints and the definition of a uniform sample from the previous two chapters. In short, a stream is read once6 min readrandom module. Algorithm R is only a few lines long, but small mistakes in those lines produce samples that look random and are stil6 min readitertools.islice.6 min readheapq, with conditional probability, and with the idea that a uniform sample of size k means every k-subset is equally likely.7 min read