From 8f7e9f5f6c6d9a016d806310510500432f7200bd Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Thu, 21 Aug 2025 17:56:09 +0800 Subject: [PATCH] Update random.c --- src/modules/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/random.c b/src/modules/random.c index bb9da9b8..cc6f2010 100644 --- a/src/modules/random.c +++ b/src/modules/random.c @@ -270,9 +270,9 @@ static bool Random_choices(int argc, py_Ref argv) { } py_f64 total = cum_weights[length - 1]; - if(total <= 0) { + if(total <= 1e-6) { 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);