def randomDeterministic(Ts):
 numA = len(Ts)
 dim = len(Ts[0])
 choices = (rand(dim) * numA).astype(int)
 policy = zeros((dim, numA))
 for (si, a) in choices:
  policy[(si, a)] = 1
 return (policy, collapsedTransitions(Ts, policy))

def randomDeterministic ( Ts ) : numA = len ( Ts ) dim = len ( Ts [ 0 ] ) choices = ( rand ( dim ) * numA ) . astype ( int ) policy = zeros ( ( dim , numA ) ) for ( si , a ) in choices : policy [ ( si , a ) ] = 1 return ( policy , collapsedTransitions ( Ts , policy ) )
pick a random deterministic action for each state .