Update random.cpp

This commit is contained in:
blueloveTH 2024-04-28 18:07:12 +08:00
parent 72d5c1cf63
commit f706944803

View File

@ -201,7 +201,7 @@ struct Random{
} }
} }
if(cum_weights[size - 1] <= 0) vm->ValueError("total of weights must be greater than zero"); if(cum_weights[size - 1] <= 0) vm->ValueError("total of weights must be greater than zero");
int k = CAST(i64, args[3]); int k = CAST(int, args[3]);
List result(k); List result(k);
for(int i = 0; i < k; i++){ for(int i = 0; i < k; i++){
f64 r = self.gen.uniform(0.0, cum_weights[size - 1]); f64 r = self.gen.uniform(0.0, cum_weights[size - 1]);