#NEWLINE# def test_uniform( self ) : #NEWLINE# #INDENT# 'Test that raw_random.uniform generates the same results as numpy.' #NEWLINE# rng_R = random_state_type ( ) #NEWLINE# ( post_r , out ) = uniform ( rng_R , ( 4 , ) , ( - 2.0 ) , 2.0 ) #NEWLINE# f = compile . function ( [ compile . In ( rng_R , value = numpy . random . RandomState ( utt . fetch_seed ( ) ) , update = post_r , mutable = True ) ] , [ out ] , accept_inplace = True ) #NEWLINE# numpy_rng = numpy . random . RandomState ( utt . fetch_seed ( ) ) #NEWLINE# val0 = f ( ) #NEWLINE# val1 = f ( ) #NEWLINE# numpy_val0 = numpy_rng . uniform ( ( - 2.0 ) , 2.0 , size = ( 4 , ) ) #NEWLINE# numpy_val1 = numpy_rng . uniform ( ( - 2.0 ) , 2.0 , size = ( 4 , ) ) #NEWLINE# print ( val0 ) #NEWLINE# print ( numpy_val0 ) #NEWLINE# print ( val1 ) #NEWLINE# print ( val1 ) #NEWLINE# self . assertTrue ( numpy . allclose ( val0 , numpy_val0 ) ) #NEWLINE# self . assertTrue ( numpy . allclose ( val1 , numpy_val1 ) )