Tools 1.7The video for this lesson is on its way.

Everything else is ready: study the parts, the key terms and the quiz below.

  1. Part 11Where this module's data came from, and why it must regenerate
  2. Part 22A call that returns different numbers every run
  3. Part 33default r n g with a seed: a generator with its own state
  4. Part 44random, integers, normal and choice, and the size argument
  5. Part 55The generator advances: the same call twice gives different values
  6. Part 66Sampling rows with choice, with and without replacement
  7. Part 77permutation: one order applied to both arrays
  8. Part 88One extra call shifts every value below it
  9. Part 99np dot random dot seed, and the legacy global stream
  10. Part 1010A seed makes a result repeatable, not correct
  11. Part 1111Regenerating this module's data from its seed
  12. Part 1212Recap and your challenge
Tools 1.7Code walkthrough12 parts

Random Numbers and Reproducibility

Generate random data you can reproduce.

Loading your progress…Next: 2.1 Meet pandas

In this lesson12 parts

  1. 01Where this module's data came from, and why it must regenerate
  2. 02A call that returns different numbers every run
  3. 03default r n g with a seed: a generator with its own state
  4. 04random, integers, normal and choice, and the size argument
  5. 05The generator advances: the same call twice gives different values
  6. 06Sampling rows with choice, with and without replacement
  7. 07permutation: one order applied to both arrays
  8. 08One extra call shifts every value below it
  9. 09np dot random dot seed, and the legacy global stream
  10. 10A seed makes a result repeatable, not correct
  11. 11Regenerating this module's data from its seed
  12. 12Recap and your challenge

Key terms

The words this lesson introduces, each in one line. The module’s glossary collects them all.

Generator
Object with its own random state and sampling methods
Seed
Starting value used to reproduce a generator's sequence
Permutation
Reordering of positions without duplication

Quiz 5 questions

Your first pick on each question is the one that counts, and a right one earns a coin. Getting one wrong here is how the lesson sticks.

Practice

Problems to solve in your own notebook. Each states the problem, not the steps: working out the steps is the exercise. Level A applies the lesson, B combines it with earlier ones, C stretches it.

The self-checking notebook for this lesson is Random numbers and reproducibility.

Where it’s used

Where this lesson’s ideas turn up in real work.