<s> from random import random <EOL> def randwalk ( n , s = <NUM_LIT:1> , s3 = '<STR_LIT>' ) : <EOL> state = s <EOL> if s3 == '<STR_LIT>' : <EOL> p32 = <NUM_LIT> <EOL> p33 = <NUM_LIT> <EOL> else : <EOL> p32 = <NUM_LIT:0.1> <EOL> p33 = <NUM_LIT> <EOL> path = str ( state ) <EOL> for i in range ( n ) : <EOL> if state == <NUM_LIT:1> : <EOL> p = random ( ) <EOL> if p <= <NUM_LIT> : <EOL> path += str ( state ) <EOL> else : <EOL> state = <NUM_LIT:2> <EOL> path += str ( state ) <EOL> elif state == <NUM_LIT:2> : <EOL> p = random ( ) <EOL> if p <= <NUM_LIT:0.1> : <EOL> state = <NUM_LIT:1> <EOL> path += str ( state ) <EOL> elif p <= <NUM_LIT> : <EOL> path += str ( state ) <EOL> else : <EOL> state = <NUM_LIT:3> <EOL> path += str ( state ) <EOL> elif state == <NUM_LIT:3> : <EOL> p = random ( ) <EOL> if p <= p32 : <EOL> state = <NUM_LIT:2> <EOL> path += str ( state ) <EOL> elif p <= p33 : <EOL> path += str ( state ) <EOL> else : <EOL> state = <NUM_LIT:4> <EOL> path += str ( state ) <EOL> elif state == <NUM_LIT:4> : <EOL> p = random ( ) <EOL> if p <= <NUM_LIT> : <EOL> path += str ( state ) <EOL> else : <EOL> state = <NUM_LIT:0> <EOL> path += str ( state ) <EOL> else : <EOL> return path <EOL> break <EOL> return path </s>
