2
\$\begingroup\$

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?

| |
\$\endgroup\$
7
\$\begingroup\$

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.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ "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. \$\endgroup\$ – Mego Jun 21 '16 at 20:06
  • \$\begingroup\$ Good point. I should have said probability 1 for every possible input. \$\endgroup\$ – Dennis Jun 21 '16 at 22:33
  • \$\begingroup\$ An answer with probability 1 can still be incorrect for every possible input. en.wikipedia.org/wiki/Almost_surely \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Jun 22 '16 at 15:23
  • \$\begingroup\$ @uoɥʇʎPʎzɐɹC That distinction is only meaningful if you execute the program an infinite number of times. \$\endgroup\$ – Dennis Jun 23 '16 at 18:02
  • \$\begingroup\$ @Dennis A simple example: Print nothing and halt. Then write a program to quit with 1/2 probability in an infinite loop. \$\endgroup\$ – jimmy23013 Jun 25 '16 at 10:56

Not the answer you're looking for? Browse other questions tagged .