Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
Explanation:
2X"¢;ÆS»ẋ"ʋ¢»
2X push a randomRandom number (1 or 2 to the stack)
"¢;ÆS» pushCompressed "duck\n"string toequivalent theto stack"duck\n"
ẋ repeatRepeat the "duck\n" that random number of times (pops the number)
"ʋ¢» pushCompresses "goose"string toequivalent theto stack"goose"
entire stack is printed implicitlyImplicitly atconcatenated programand terminationreturned
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
Explanation:
2X"¢;ÆS»ẋ"ʋ¢»
2X push a random number 1 or 2 to the stack
"¢;ÆS» push "duck\n" to the stack
ẋ repeat the "duck\n" that random number of times (pops the number)
"ʋ¢» push "goose" to the stack
entire stack is printed implicitly at program termination
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
Explanation:
2X"¢;ÆS»ẋ"ʋ¢»
2X Random number (1 or 2)
"¢;ÆS» Compressed string equivalent to "duck\n"
ẋ Repeat the "duck\n" that random number of times
"ʋ¢» Compresses string equivalent to "goose"
Implicitly concatenated and returned
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
Explanation:
2X"¢;ÆS»ẋ"ʋ¢»
2X push a random number 1 or 2 to the stack
"¢;ÆS» push "duck\n" to the stack
ẋ repeat the "duck\n" that random number of times (pops the number)
"ʋ¢» push "goose" to the stack
entire stack is printed implicitly at program termination
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
Explanation:
2X"¢;ÆS»ẋ"ʋ¢»
2X push a random number 1 or 2 to the stack
"¢;ÆS» push "duck\n" to the stack
ẋ repeat the "duck\n" that random number of times (pops the number)
"ʋ¢» push "goose" to the stack
entire stack is printed implicitly at program termination
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
More readable version: Try it online!
Will always return 1 or 2 ducks.
Jelly, 13 bytes
2X"¢;ÆS»ẋ"ʋ¢»
More readable version: Try it online!
Will always return 1 or 2 ducks.