Skip to content

Commit ba626a7

Browse files
Create weighted_mustafafurkan_yilmaz.py
1 parent 905e905 commit ba626a7

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 = None, 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)