numpy.random.randint() — one of the functions for random sampling in numpy. It returns an array of the specified shape and fills it with random integers from low (inclusive) to high (excluding), that is, in the range
Syntax: numpy.random.randint (low, high = None, size = None, dtype = `l`)
low: [int] Lowest (signed) integer to be drawn from the distribution.But, it works as a highest integer in the sample if high = None.
high: strong> [int, optional] Largest (signed) integer to be drawn from the distribution.
size: [int or tuple of ints, optional] Output shape. If the given shape is, eg, (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.
dtype: [optional] Desired output data-type.
Return: strong > Array of random integers in the interval
[low, high)or a single such random int if size not provided.
Code # 1: strong>
Output 1D Array filled with random integers: [1 1 0 1 1]
Code # 2:
Output 2D Array filled with random integers: [[1 1 0] [1 0 3]]
Code # 3:
Output 3D Array filled with random integers: [[[4 8 5 7] [6 5 6 7] [4 3 4 3]] [[2 9 2 2] [3 2 2 3] [6 8 3 2]]]
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems PDF, 2nd Edition. This book assumes you know next to nothing about m...
Deep Learning for Coders with fastai and PyTorch: AI Applications Without a PhD. Deep learning is often seen as the exclusive domain of math PhDs and big tech companies. But as this how-to guide sh...
This book introduces machine learning methods in finance. It features a unified treatment of machine learn...
Mastering regular expressions by Jeffrey Friedl, 3rd edition. Regular expressions are an extremely powerful tool for manipulating text and data. They are standard features today in a variety of pop...