How to Generate Random Numbers in Python

Last Updated on September 4, 2020

The use of randomness is an important part of the configuration and evaluation of machine learning algorithms.

From the random initialization of weights in an artificial neural network, to the splitting of data into random train and test sets, to the random shuffling of a training dataset in stochastic gradient descent, generating random numbers and harnessing randomness is a required skill.

In this tutorial, you will discover how to generate and work with random numbers in Python.

After completing this tutorial, you will know:

  • That randomness can be applied in programs via the use of pseudorandom number generators.
  • How to generate random numbers and use randomness via the Python standard library.
  • How to generate arrays of random numbers via the NumPy library.

Kick-start your project with my new book Statistics for Machine Learning, including step-by-step tutorials and the Python source code files for all examples.

Let’s get started.

How to Generate Random Numbers in Python

How to Generate Random Numbers in Python
Photo by Harold Litwiler, some rights reserved.

Tutorial
To finish reading, please visit source site