Random Matrix Generator Using NumPy

  • Share this:

Code introduction


This function takes two arguments, arg1 and arg2, and generates a random matrix of size (arg1, arg2) using numpy's random module.


Technology Stack : numpy, random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import numpy as np

def random_matrix(arg1, arg2):
    # This function generates a random matrix of size (arg1, arg2) using numpy's random module
    return np.random.rand(arg1, arg2)                
              
Tags: