Randomness#

Learning Objectives#

After working through this topic, you should be able to:

  • Generate random number with numpy

  • Explain the role of a seed in random number generation

  • Follow best practices for generating random numbers

Materials#

Video:

Download the slides.

  • This Blogpost explains some of the reasons behind our best practices.

  • If you find the “legacy” version of the NumPy random number generator somewhere (i.e., calling np.random.seed. E.g., LLMs are trained on lots of data using that…), a clear exposition of why you want to use the suggested version can be found here.

Quiz#