This is easier to do if the weights are not negative. If you must have negative weights, you will have to compensate for the scales with the lowest weight. In your case, offsetted_weight = itemweight + 100
In pseudo code, it looks like this:
Calculate the sum of all the weights. Do a random from 0 to the sum of the weights Set i to 0 While the random number > 0 Subtract the weight of the item at index i from random If the random number is < 0 return item[i] Add 1 to i
source share