Random number generation
One of the developers has written a piece of code which, in about five different computations, ends up assigning a single random number to a record. The five separate computations allow each one to be weighted, so that the final random number takes account of the relative importance of the individual components.
For example, take the number of records assigned to customer X as a proportion of total records, and multiply that by a random number. Multiply by 5
Then take the average age of the records assigned to a customer and multiply that by another random number. Multiply by 2.
...
Add the first random number to the second (and others...) to arrive at a single random number.
The weighting system can only work properly if the random number generated at each step is in the same sort of range as all the others. That is, a random number is always between 0 and 10, because if you could randomly be assigned a random number of, say, 10,000 in step 2, that would swamp the 'times 2' weighting.
The developer has therefore written code like dbms_random(value, 0,10), which works well in returning a random number only within specified limits.
I've pointed out, however, that DBMS_RANDOM is now officially deprecated and we ought to be using DBMS_CRYPTO.RANDOMNUMBER instead... but that procedure doesn't seem to let you say 'random numbers need to be within this range' as DBMS_RANDOM does. So as far as I can tell, we can't use this new package.
So after a very long explanation, my question: how do I not use DBMS_RANDOM whilst still having control over the range of numbers that DBMS_CRYPTO can return?
Any help would be appreciated. I have Googled, but to no great effect: most of the articles I've found are discussing dbms_crypto's advanced cryptographical features, not its basic number generation ones.