mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
Update random.c
This commit is contained in:
parent
b3bbe3be58
commit
8f7e9f5f6c
@ -270,9 +270,9 @@ static bool Random_choices(int argc, py_Ref argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
py_f64 total = cum_weights[length - 1];
|
py_f64 total = cum_weights[length - 1];
|
||||||
if(total <= 0) {
|
if(total <= 1e-6) {
|
||||||
PK_FREE(cum_weights);
|
PK_FREE(cum_weights);
|
||||||
return ValueError("total of weights must be greater than zero");
|
return ValueError("total of weights must be greater than 1e-6");
|
||||||
}
|
}
|
||||||
|
|
||||||
py_newlistn(py_retval(), k);
|
py_newlistn(py_retval(), k);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user