We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 21d0e1d + 75b81fb commit 73c0c76Copy full SHA for 73c0c76
Week02/weighted_semi_kazar.py
@@ -0,0 +1,9 @@
1
+import random
2
+
3
+def weighted_srs(data, n, weights, with_replacement = False):
4
+ if not (with_replacement or weights):
5
+ sample = random.sample(data, n)
6
+ else:
7
+ sample = random.choices(data, weights=weights, k=n)
8
9
+ return sample
0 commit comments