James McCool commited on
Commit
f93672b
·
1 Parent(s): 54ce19d

Shuffle player rows in exposure_spread function to ensure random selection of players for lineup adjustments, enhancing variability in exposure calculations.

Browse files
Files changed (1) hide show
  1. global_func/exposure_spread.py +4 -1
global_func/exposure_spread.py CHANGED
@@ -270,8 +270,11 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
270
 
271
  change_counter = 0
272
 
 
 
 
273
  # for each row to the the number of lineups to remove, replace with random choice from comparable player list
274
- for row in player_rows.index:
275
  if change_counter < math.ceil(lineups_to_remove):
276
  insert_player = random.choice(comparable_player_list)
277
  # Find which column contains the exposure_player
 
270
 
271
  change_counter = 0
272
 
273
+ random_row_indices = list(player_rows.index)
274
+ random.shuffle(random_row_indices)
275
+
276
  # for each row to the the number of lineups to remove, replace with random choice from comparable player list
277
+ for row in random_row_indices:
278
  if change_counter < math.ceil(lineups_to_remove):
279
  insert_player = random.choice(comparable_player_list)
280
  # Find which column contains the exposure_player