I\'m looking for the best way of implementing random number generator, that will allow me to have control over probability from what range the generated number will be retur
Hmm, working on your original I had a pretty simple algorithm to generate ranges in an array in the appropriate proportion, then randomly select a range and generate a random number within that range. No doubt it can be optimised if necessary, but it works for me.
It looks like a lot of code, but 3/4 of it is comments, test data and function, the actual randomRange function is only 17 lines of code.
Numbers 0 - 20
Numbers 21 - 400