http://qs321.pair.com?node_id=711315


in reply to Golf: Movie style code cracker.

108 characters:

Update: Adopted the required counting method, thus I have 108 characters, not 103.

Update 2: New version with 71 characters (however it would be a few (about 4) characters more if I hadn't copied a trick from BrowserUk; I'll elaborate in the spoiler tag):

Caveat: The second version will probably not terminate for a 1-digit code.

Update 3: :-( I just noticed that my 71 character solution has the problem that it always prints "8" as the last digit. For the moment, I offer the following fix, which makes it 75 characters long (and I'll omit the spoiler tags as the contest seems to be over):

-l15e'print|substr$_||=1x($l=pop),~rand$l,1,~~rand 10 while++$A%1e6||- +-$l'

(And you can modify the 1e6 constant to shorten the runtime.)