lundi 4 octobre 2021

Probability Density Function Plots for random.random in Python

I am a newbie to python, and I want to generate the identical PDF plots as shown below:

enter image description here

Here is my current version of implementation, which doesn't produce the same plots:

import random
import matplotlib.pyplot as plt

plt.figure('PDF for random.random()')
plt.title('PDF for random.random()')
plt.plot(random.random())

plt.figure('PDF for random.random() + random.random()')
plt.title('PDF for random.random() + random.random()')
plt.plot(random.random() + random.random())

plt.figure('PDF for random.random() + random.random() + random.random()')
plt.title('PDF for random.random() + random.random() + random.random()')
plt.plot(random.random() + random.random() + random.random())

plt.show()

Where did I do it wrong?




Aucun commentaire:

Enregistrer un commentaire