Skip to content

Commit

Permalink
jitter range check
Browse files Browse the repository at this point in the history
  • Loading branch information
elegantmoose committed Feb 12, 2024
1 parent 3fab8c6 commit 80395d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/utility/base_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def encode_string(s):
@staticmethod
def jitter(fraction):
i = fraction.split('/')
return randint(int(i[0]), int(i[1]))
min, max = int(i[0]), int(i[1])
if min > max:
logging.warn('Jitter range max value (max={max}) less than min value (min={min}). Using min={max} and max={min}.')
min, max = max, min
return randint(min, max)

@staticmethod
def create_logger(name):
Expand Down

0 comments on commit 80395d1

Please sign in to comment.