def binomial(random_state, size=None, n=1, p=0.5, ndim=None,
             dtype='int64', prob=None):
    """
    Sample n times with probability of success prob for each trial,
    return the number of successes.

    If the size argument is ambiguous on the number of dimensions, ndim
    may be a plain integer to supplement the missing information.

    If size is None, the output shape will be determined by the shapes
    of n and prob.

    """
    if prob is not None:
        p = prob
        print("DEPRECATION WARNING: the parameter prob to the binomal fct have been renamed to p to have the same name as numpy.", file=sys.stderr)
    n = tensor.as_tensor_variable(n)
    p = tensor.as_tensor_variable(p)
    ndim, size, bcast = _infer_ndim_bcast(ndim, size, n, p)
    if n.dtype == 'int64':
        try:
            numpy.random.binomial(n=numpy.asarray([2, 3, 4], dtype='int64'), p=numpy.asarray([.1, .2, .3], dtype='float64'))
        except __HOLE__:
            # THIS WORKS AROUND A NUMPY BUG on 32bit machine
            n = tensor.cast(n, 'int32')
    op = RandomFunction('binomial',
                        tensor.TensorType(dtype=dtype,
                                          broadcastable=(False,) * ndim))
    return op(random_state, size, n, p)
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/raw_random.py/binomial