Rewrite getWeightedRandom implementation
Rewrite getWeightedRandom implementation

Use a more precise algorithm to randomize the output of this function.
Previously, we could not guarantee that the sum of the "normalized"
weights was an integer value, and so the range of the random number
would not necessarily cover the sum of the weights.

Now, we properly normalize between 0 and 1, and choose a random number
between 0 and 1.

Fixes PHPStan warning:

> Parameter #2 $max of function rand expects int, float|int given.

hemberger/smr,hemberger/smr,smrealms/smr,smrealms/smr,hemberger/smr,hemberger/smr,smrealms/smr