[Math] Generating random numbers of bell curve distribution

normal distributionrandom

I want to generate random numbers that fit a bell curve distribution.

Basicly, I need random numbers from 0 to 1, but I wish to have a high likelihood of it being close to 0.5, but not guaranteed, and I believe the bell curve distribution fits my requirements best.

The issue is, assuming standard divination of 1 and mean of 0.5, how to I take this bell curve formula,
$$\large{\frac{1 }{ \sqrt{2 \pi}} \cdot e ^{-\frac{(x – 0.5)^2 }{ 2}}}$$

and rearrange it to be able to modify my uniform random numbers from 0 to 1 to fit the bell curve distribution?

Best Answer

A bell curve is the most common type of distribution for a variable, and due to this fact, it is known as a normal distribution

Here is how you can actually do it

https://www.alanzucconi.com/2015/09/16/how-to-sample-from-a-gaussian-distribution/

however there are already libraries that can do this for you Here is a simple python code that demonstrate normal distribution


import numpy as np

import matplotlib.pyplot as plt

x = np.random.normal(0.5,1,1000)      # 1000 points with mean 0.5 and cov 1

I think this should help

Related Question