Write a program that is capable of randomly generating itself.
It must do this based on the tokens used in its source code. If your program's source code is composed of 50 unique tokens and is 60 tokens long, then the program should output 60 tokens where each token is randomly chosen from one of the 50 unique tokens.
For example, this program would have a one in 50^60 chance to reproduce itself.
What is a token? That depends on the language. For example, identifiers (foo_bar
), keywords (while
), and numbers (42
) would count as tokens in most languages. Whitespace would not count in most languages.
Additional rules:
- Output may only contain tokens found in the programs source code, separated by the appropriate delimiter
- Output must be the same length as the program's source code, counted by tokens
- Only one programming language may be used
- Source code must have at least 3 unique tokens
- Exclude comments from the source code
- Program should only have a one in U^L chance to reproduce itself
Scoring: The program that has the best chance to reproduce itself, wins.