Hi Searle,
searle wrote:- find a random r number between -1530; 1530
Here, you can't say this straight because [-1530; 1530] are the bounds of the
sum of random numbers, not the random number itself.
The distribution is not linear:
When you take 12 random numbers between [0;255] ([0; 1.0] because fixed) and you sum them up, you obtain a gaussian distribution. In fact, the result follows a "normal law" when the number of dices (here 12) tends to infinite.
So, you can't say that taking a number between [0;8] is the same as the sum of 4 random numbers between [0;2] because the distribution (the probability to have a 4 for example) is not the same.
After the sum, the result is centered at 0 by substracting 1530. And finally, it's divided according to Y like you said.
The result is a fixed number on two bytes (a word) where the fixed part is in the low byte. So the result is between [-5.98...; 5.98...].
Does this help you ?
Cheers,
Kroah