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.