> How can I generate n random numbers whose summation will be around 1? You can try the [Dirichlet distribution]( http://en.wikipedia.org/wiki/Dirichlet_distribution#String_cutting) (see also, https://statipedia.org/wiki/index.php?title=Dirichlet). You need to specify more details about how they're distributed; using only the sum-constraint condition allows too many possible distributions over parameters. The Dirichlet is a commonly used distribution which satisfies this property.