



"""simple docstring"""






from ..utils import DummyObject, requires_backends






class        __snake_case       (	metaclass=_lowercase):
  snake_case__				:   Union[str, Any]  			=						["torch", "torchsde"]




  def __init__( self     :						Dict						,					*__lowerCAmelCase     :						str						,					**__lowerCAmelCase     :						Optional[int]		):






         """simple docstring"""






         requires_backends(self						,					['''torch''', '''torchsde''']		)




  @classmethod
  def 						SCREAMING_SNAKE_CASE				( cls     :						Optional[int]						,					*__lowerCAmelCase     :						List[Any]						,					**__lowerCAmelCase     :						Optional[Any]		):






         """simple docstring"""






         requires_backends(cls						,					['''torch''', '''torchsde''']		)




  @classmethod
  def 						SCREAMING_SNAKE_CASE				( cls     :						int						,					*__lowerCAmelCase     :						str						,					**__lowerCAmelCase     :						str		):






         """simple docstring"""






         requires_backends(cls						,					['''torch''', '''torchsde''']		)







from math import factorial
def        lowercase_							(A : int		,					A : int		,					A : float      ):
       if successes > trials:
              raise ValueError('successes must be lower or equal to trials'      )
       if trials < 0 or successes < 0:
              raise ValueError('the function is defined for non-negative integers'      )
       if not isinstance(A		,					A      ) or not isinstance(A		,					A      ):
              raise ValueError('the function is defined for non-negative integers'      )
       if not 0 < prob < 1:
              raise ValueError('prob has to be in range of 1 - 0'      )
       snake_case__							:	List[Any]   	=	(prob**successes) * ((1 - prob) ** (trials - successes))
       # Calculate the binomial coefficient: n! / k!(n-k)!
       snake_case__							:	List[str]   	=	float(factorial(A      )      )
       coefficient /= factorial(A      ) * factorial(trials - successes      )
       return probability * coefficient


if __name__ == "__main__":
 from doctest import testmod

 testmod()
 print("Probability of 2 successes out of 4 trails")
 print("with probability of 0.75 is:", end=" ")
 print(binomial_distribution(2, 4, 0.75))






