Random Normal Distribution Generator

  • Share this:

Code introduction


This function uses the numpy library to generate a random sample from a normal distribution, where the parameter arg1 specifies the mean of the sample and the parameter arg2 specifies the standard deviation.


Technology Stack : numpy, pandas, scipy

Code Type : Python Function

Code Difficulty : Intermediate


                
                    
import numpy as np
import pandas as pd
from scipy import stats

def random_normal_distribution(arg1, arg2):
    # Generate a random sample from a normal distribution with mean arg1 and standard deviation arg2
    return np.random.normal(arg1, arg2)