def test_theano_rng():
 rngs = [make_theano_rng(rng_or_seed=42, which_method='uniform'), make_theano_rng(rng_or_seed=RandomStreams(42), which_method='uniform'), make_theano_rng(default_seed=42), make_theano_rng()]
 functions = [theano.function([], rng.uniform(size=(100,))) for rng in rngs]
 random_numbers = functions[0]()
 equals = numpy.ones((100,))
 for function in functions[1:]:
  equal = (random_numbers == function())
  equals *= equal
 assert equals.all()

def test_theano_rng ( ) : rngs = [ make_theano_rng ( rng_or_seed = 42 , which_method = 'uniform' ) , make_theano_rng ( rng_or_seed = RandomStreams ( 42 ) , which_method = 'uniform' ) , make_theano_rng ( default_seed = 42 ) , make_theano_rng ( ) ] functions = [ theano . function ( [ ] , rng . uniform ( size = ( 100 , ) ) ) for rng in rngs ] random_numbers = functions [ 0 ] ( ) equals = numpy . ones ( ( 100 , ) ) for function in functions [ 1 : ] : equal = ( random_numbers == function ( ) ) equals *= equal assert equals . all ( )
tests that the four possible ways of creating a theano rng give the same results with the same seed .