random.betavariate() method in Python Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report betavariate() is an inbuilt method of the random module. It is used to return a random floating point number with beta distribution. The returned value is between 0 and 1. Syntax : random.betavariate(alpha, beta) Parameters : alpha : greater than 0 beta : greater than 0 Returns : a random beta distribution floating number between 0 and 1 Example 1: # import the random module import random # determining the values of the parameters alpha = 5beta = 10 # using the betavariate() method print(random.betavariate(alpha, beta)) Output : 0.5148685287422776 Example 2: We can generate the number multiple times and plot a graph to observe the beta distribution. # import the required libraries import random import matplotlib.pyplot as plt # store the random numbers in a # list nums = [] low = 10high = 100mode = 20 for i in range(100): temp = random.betavariate(5, 10) nums.append(temp) # plotting a graph plt.plot(nums) plt.show() Output : Last Updated : 17 May, 2020 Like Article Save Article Previous random.triangular() method in Python Next random.expovariate() function in Python Share your thoughts in the comments Add Your Comment Please Login to comment...