You can download this code by clicking the button below.
This code is now available for download.
This function generates a random matrix with specified number of rows, columns, and a range of values.
Technology Stack : NumPy
Code Type : Function
Code Difficulty : Intermediate
import numpy as np
def generate_random_matrix(rows, cols, min_val, max_val):
"""
Generates a random matrix with specified number of rows, columns, and range of values.
"""
return np.random.randint(min_val, max_val + 1, size=(rows, cols))
# JSON Explanation