We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8112eb5 + 25dac0c commit 21d0e1dCopy full SHA for 21d0e1d
Week02/weighted_deniz_akgul.py
@@ -0,0 +1,5 @@
1
+import random
2
+def weighted_srs(data, n, weights, with_replacement=False):
3
+ if with_replacement or weights:
4
+ return random.choices(data, weights=weights, k=n)
5
+ return random.sample(data, n)
0 commit comments