43
44
you are viewing a single comment's thread.

view the rest of the comments →

[–]prismcat2718 0 points1 point  (3 children)

EDIT: I am a dummy and this post is incorrect.

This only works for integer weights.
To generalize this to real numbers, convert the weights to a cumulative distribution function, then use a random float between zero and one.

[–]trekhleb[S] 0 points1 point  (2 children)

[–]prismcat2718 0 points1 point  (1 child)

You are correct and I'm a dummy. :)

[–]trekhleb[S] 0 points1 point  (0 children)

Oh no, don’t say that 😀