Skip to content

Commit 46f91f2

Browse files
committed
Wrap at 79 chars, clarify sigma as a proportion
1 parent 720f11d commit 46f91f2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

amdahl/amdahl.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ def random_jitter(x, sigma=0.2):
9797
Apply a random offset of ±20% to a value
9898
"""
9999
# Make sure sigma is between 0 and 1
100-
if sigma < 0 or sigma > 1 :
100+
if sigma < 0 or sigma > 1:
101101
sys.stdout.write(
102-
"Illegal value for sigma (%f), should be a float between 0 and 1!\n" % sigma
103-
"Using 0.2 instead..."
102+
"Illegal value for sigma ({}), "
103+
"should be a float between 0 and 1!\n"
104+
"Using 0.2 instead...".format(sigma)
104105
)
105106
sigma = 0.2
106107
# random() returns a float between 0 and 1, map between -sigma and +sigma
107-
jitter_percent = sigma * ((random.random() * 2) - 1)
108-
return (1 + jitter_percent) * x
108+
jitter_proportion = sigma * ((random.random() * 2) - 1)
109+
return (1 + jitter_proportion) * x
109110

110111

111112
def parse_command_line():

0 commit comments

Comments
 (0)