in reply to Weighted random selection
If you do mind, you could just sum up the all the weights and do the looking up on a second walkthrough. Definitely more memory efficient and if your weights are above 2 on average it would be faster too.
You could also keep a running weight total that would be updated on every addition or deletion in the group.
|
|---|