From f5b943630771e01cd97272502f38cbc99675480c Mon Sep 17 00:00:00 2001 From: YigitKDA <154975871+YigitKDA@users.noreply.github.com> Date: Tue, 26 May 2026 14:23:44 +0300 Subject: [PATCH] Create weighted_yigit_kizildag.py --- weighted_yigit_kizildag.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 weighted_yigit_kizildag.py diff --git a/weighted_yigit_kizildag.py b/weighted_yigit_kizildag.py new file mode 100644 index 00000000..76a02e67 --- /dev/null +++ b/weighted_yigit_kizildag.py @@ -0,0 +1,7 @@ +import random + +def weighted_srs(data: list,n: int,weights: list,with_replacement: bool= False): + if(with_replacement): + return random.choices(population=data,weights=weights,cum_weights=None,k=n) + + return random.sample(population=data,k=n,counts=weights)