#NEWLINE# def test_binomial( self ) : #NEWLINE# #INDENT# 'Test that raw_random.binomial generates the same results\n        as numpy.' #NEWLINE# rng_R = random_state_type ( ) #NEWLINE# ( post_r , bin ) = binomial ( rng_R , ( 7 , 12 ) , 5 , 0.8 ) #NEWLINE# f = compile . function ( [ compile . In ( rng_R , value = numpy . random . RandomState ( utt . fetch_seed ( ) ) , update = post_r , mutable = True ) ] , [ bin ] , accept_inplace = True ) #NEWLINE# numpy_rng = numpy . random . RandomState ( utt . fetch_seed ( ) ) #NEWLINE# val0 = f ( ) #NEWLINE# val1 = f ( ) #NEWLINE# numpy_val0 = numpy_rng . binomial ( 5 , 0.8 , size = ( 7 , 12 ) ) #NEWLINE# numpy_val1 = numpy_rng . binomial ( 5 , 0.8 , size = ( 7 , 12 ) ) #NEWLINE# print ( val0 ) #NEWLINE# print ( numpy_val0 ) #NEWLINE# print ( val1 ) #NEWLINE# print ( numpy_val1 ) #NEWLINE# self . assertTrue ( numpy . all ( ( val0 == numpy_val0 ) ) ) #NEWLINE# self . assertTrue ( numpy . all ( ( val1 == numpy_val1 ) ) )