# Is it OK for an answer to not work from time to time if the language it's written in is probabilistic? [duplicate]

If an answer is written in a language that deliberately prevents the programs written with it from doing the same output/calculations/etc. every time by introducing randomness, should it be deleted anyway?

# No, it is not OK

If allowed, in an hypothetical probabilistic language that simply executes a random program without even looking at its source code, the empty program would be a solution to all code golf challenges.

On top of that we already reached consensus that all answers must work with probability 1, for every possible input.

• "Probability 1" is even still too loose - we require that every possible (valid) input results in a correct output. A solution could have an infinite set of inputs that work and a finite set of inputs that don't, and would still have probability 1 of working.
– user45941
Jun 21, 2016 at 20:06
• Good point. I should have said probability 1 for every possible input. Jun 21, 2016 at 22:33
• An answer with probability 1 can still be incorrect for every possible input. en.wikipedia.org/wiki/Almost_surely Jun 22, 2016 at 15:23
• @uoɥʇʎPʎzɐɹC That distinction is only meaningful if you execute the program an infinite number of times. Jun 23, 2016 at 18:02
• @Dennis A simple example: Print nothing and halt. Then write a program to quit with 1/2 probability in an infinite loop. Jun 25, 2016 at 10:56