#NEWLINE# def _gauss_pair_impl( _random ) : #NEWLINE# #INDENT# def compute_gauss_pair( ) : #NEWLINE# #INDENT# '\n        Compute a pair of numbers on the normal distribution.\n        ' #NEWLINE# while True : #NEWLINE# #INDENT# x1 = ( ( 2.0 * _random ( ) ) - 1.0 ) #NEWLINE# x2 = ( ( 2.0 * _random ( ) ) - 1.0 ) #NEWLINE# r2 = ( ( x1 * x1 ) + ( x2 * x2 ) ) #NEWLINE# if ( ( r2 < 1.0 ) and ( r2 != 0.0 ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# f = math . sqrt ( ( ( ( - 2.0 ) * math . log ( r2 ) ) / r2 ) ) #NEWLINE# return ( ( f * x1 ) , ( f * x2 ) ) #NEWLINE# #UNINDENT# return compute_gauss_pair