Hi, I am think about the probability of a number in a restricted area.
psydo-code:
1 2 3 4 5
| float result float value
int x = rand.nextInt(maxX - minX + 1) + minX; |
I thought about multiplying it with another random but I don't know how I put the "value" in it, because I would like to have a linear change of the highest probability.
thx for help,
<edit name = "Wasn't able to explain it, so here we go with an example">
Let me try to explain it with an example:
result should be between 10 and 100
if value is 0.01; the result probably is rather 10, 11, 12 (little results)
if value is 0.25; the result probably is rather 25, 26, 27 (bigger little results)
if value is 0.5; the result probably is rather 49, 50, 51 (medium results)
if value is 0.75; the result probably is rather 74, 75, 76 (bigger medium results)
if value is 0.99; the result probably is rather 98, 99, 100 (big results)
I would like to set the expectancy of the result with "value"
</edit>
best regards