[Math] Generating random numbers with skewed distribution

probabilityprobability distributionsrandomstatistics

I want to generate random numbers with skewed distribution. But I have only following information about distribution from the paper :

skewed distribution where the value is 1 with probability 0.9 and 46 with probability 0.1. the distribution has mean (5.5)

I don't know how to generate random numbers with this information and I don't know what is the distribution function.

I'm using jdistlib for random number generation. If anyone has experience using this library can help me with this library for skewed distribution random number generation?

Best Answer

What copperhat is hinting at is the following algorithm:

Generate u, uniformly distributed in [0, 1]
If u < 0.9 then
   return 1
else
   return 46

(sorry, would be a mess as a comment).

In general, if you have a continuous distribution with cummulative distribution $c(x)$, to generate the respective numbers get $u$ as above, $c^{-1}(u)$ will have the required distribution. Can do the same with discrete distributions, essentially searching where the $u$ lies in the cummulative distribution.

An extensive treatment of generating random numbers (including non-uniform ones) is in Knuth's "Seminumerical Algorithms" (volume 2 of "The Art of Computer Programming"). Warning, heavy math involved.