Generating Random Matrix with Numpy

  • Share this:

Code introduction


This function generates a random matrix of size n x m using the numpy library.


Technology Stack : numpy

Code Type : Function

Code Difficulty : Intermediate


                
                    
def random_matrix(n, m):
    """
    Generate a random matrix of size n x m using the numpy library.
    """
    import numpy as np
    return np.random.rand(n, m)                
              
Tags: