synthesizer.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Imagyn 作者: zevisert 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号