We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 924b4a2 + 4646733 commit 331f10eCopy full SHA for 331f10e
Week03/weighted_hakan_magat.py
@@ -0,0 +1,8 @@
1
+import random #random
2
+
3
+def weighted_srs(data, n, weights, with_replacement = False):
4
+ if with_replacement == True or weights != None:
5
+ randomlist = random.choices(data, k = n, weights = weights)
6
+ else:
7
+ randomlist = random.sample(data, n)
8
+ return randomlist
0 commit comments