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)