Skip to content

Commit 40f7f13

Browse files
authored
Merge pull request #108 from MustafaFurkan0/patch-1
Create weighted_mustafafurkan_yilmaz.py
2 parents 8d271d4 + 37ce4f9 commit 40f7f13

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import random
2+
3+
def weighted_srs(data, n, weights, with_replacement = False):
4+
if weights == None and with_replacement == False:
5+
return random.sample(data, n)
6+
else:
7+
return random.choices(data, weights = weights, k = n)

0 commit comments

Comments
 (0)