An IDE developer has hired you to write a program that generates (by printing to stdout) n lines of randomly generated code. They will use your program to create sample code for use in marketing their newest compiler.
Please include a few sample outputs to demonstrate your program's capabilities.
The winning program should implement all the above features, and generate realistic code without sacrificing execution time or program length (to a huge degree - this isn't golf).
The winner will be chosen by community vote from entries received before 1st May 2012. Voting should be based upon realism, variety, creativity and adherence to the criteria above.
Did it in Brainfuck! I had a bit of trouble generating random numbers. I hoped something simple like a LFSR could give me a fairly decent looking sequence, but I found it looped too quickly and gave boring output. I resorted to using a RNG found here, which actually takes quite a long time to run. Since BF has no capacity to get any source of entropy from the operating system, I first have the user input any text (I pound on they keyboard) to seed the RNG. After that it takes the number of lines and outputs random BF, using 16 hard-coded subsequences.
and it runs in about 2 minutes on my box. Output contains entirety of BF syntax, including comments, and it well formed.
Not the answer you're looking for? Browse other questions tagged code-challenge random generation or ask your own question.