# encoding=utf8

r"""

Module containing classes and class methods related to discrete distributions.

"""

import numpy as np

from mathpy.combinatorics.binomial import binom_coeff
from mathpy.random.sample import bernoulli, binomial


class Bernoulli(object):
    r"""
    A Bernoulli discrete random variable. The Bernoulli distribution is the probability
    distribution of Bernoulli trials ('Success/Failure', 'True/False', etc.).

    Attributes
    ----------
    p
        The probability of success of the Bernoulli trial
    q
        The probability of failure of the Bernoulli trial. Equal to :math:`1 - p`

    Methods
    -------
    pmf(k)
        Estimates the probability mass function (probability distribution function of a
        discrete distribution) given probability of success :math:`p` and support
        :math:`k \in [0, 1]`.
    cdf(k)
        Estimates the cumulative distribution function given probability of success :math:`p`
        and support :math:`k \in [0, 1]`.
    mean()
        Calculates the mean of the Bernoulli distribution, which is equivalent to the probability
        of success :math:`p`. The mean is also known as the first moment.
    median()
        Calculates the median of the Bernoulli distribution.
    mode()
        Computes the mode of the Bernoulli distribution.
    variance()
        Method for determining the variance, also known as the second moment, of the Bernoulli
        distribution.
    skewness()
        Returns the skewness (third moment) of the Bernoulli distribution.
    kurtosis()
        Calculates the kurtosis (fourth moment) of the Bernoulli distribution.
    entropy()
        Computes the entropy of the Bernoulli distribution.
    sample(n)
        Draws n random samples from the Bernoulli distribution with given the parameter :math:`p`.

    Notes