create numpy table with random values in range

Solutions on MaxInterview for create numpy table with random values in range by the best coders in the world

showing results for - "create numpy table with random values in range"
Lucia
17 Jun 2020
1import numpy as np
2
3# if the shape is not mentioned the output will just be a random integer in the given range
4rand_int = np.random.randint(5,10)  
5print("First array", rand_int)
6
7rand_int2 = np.random.randint(10,90,(4,5)) # random numpy array of shape (4,5)
8print("Second array", rand_int2)
9
10rand_int3 = np.random.randint(50,75,(2,2), dtype='int64')
11print("Third array", rand_int3)
12