def build_normal_distribution(maximum, minimum, mean, deviation, integer=False):
"""
Build a normal distribution to use for randomizing values for input into transformation functions\n
:param maximum: Float or int, The maximum value the value can be]\n
:param minimum: Float or int, The minimum value the value can be\n
:param mean: Float, the mean (mu) of the normal distribution\n
:param deviation: Float, the deviation (sigma) of the normal distribution\n
:param integer: OPTIONAL, whether the value is required to be an integer, otherwise False\n
:return: Float or int, The value to insert into the transform function
"""
value = random.gauss(mean, deviation)
if integer is True:
value = round(value)
if value > maximum:
value = maximum
elif value < minimum:
value = minimum
return value
评论列表
文章目录