rxi / lume

Lua functions geared towards gamedev
MIT License
997 stars 80 forks source link

lume.weightedchoice - if rnd <= v instead of if rnd < v #41

Open WilliamArnone opened 2 years ago

WilliamArnone commented 2 years ago

if you have a table {"first"=2, "second"=1} and the random pulls out a 3, rnd values are: 3 then 3-2 = 1 and then 1<1 is false, weightedchoice returns nil.