Calculating normalized karma
algorithm
Solution
min_karma = min(karmas)
max_karma = max(karmas)
normalized = (karma - min_karma) / (max_karma - min_karma)
This has the property that the user(s) with karma = min_karma get a normalised karma of 0, and users with karma = max_karma get 1. Others are linearly distributed in between. You will have to handle separately the special case that all users have the same karma.
If you want a non-linear distribution you could use a logarithmic function:
normalized = (log(karma) - log(min_karma)) / (log(max_karma) - log(min_karma))
It is important in this case that the karma can never fall below 1, as this could skew the results.
Problem
How could I calculate a normalized value of karma (value between 0 and 1), from the karma of users in my system? The normalized value should reflect the value of the user's karma relative to all other users. I think I would probably have to include the average and standard deviations of all karma's somehow, but I can't seem to come up with the right formula. Any help?