Random Matrix Generator

  • Share this:

Code introduction


This function generates a random matrix of shape (arg1, arg2) with values between 0 and 1, based on the two input parameters arg1 and arg2.


Technology Stack : numpy

Code Type : Function

Code Difficulty : Intermediate


                
                    
import numpy as np

def random_matrix(arg1, arg2):
    """
    Generate a random matrix of shape (arg1, arg2) with values between 0 and 1.
    """
    return np.random.rand(arg1, arg2)                
              
Tags: