rand.py 文件源码

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

项目:blur 作者: ajyoon 项目源码 文件源码
def _normal_function(x, mean, variance):
    """
    Find a value in the cumulative distribution function of a normal curve.

    See https://en.wikipedia.org/wiki/Normal_distribution

    Args:
        x (float): Value to feed into the normal function
        mean (float): Mean of the normal function
        variance (float): Variance of the normal function

    Returns: float

    Example:
        >>> round(_normal_function(0, 0, 5), 4)
        0.1784
    """
    e_power = -1 * (((x - mean) ** 2) / (2 * variance))
    return (1 / math.sqrt(2 * variance * math.pi)) * (math.e ** e_power)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号