///, 72 bytes
/+*/+*// */a random number between 0 and 0//*/"Hello World"/
Try it online!
Here I go again, adding another cheating entry. Was I really going write my own pseudo-random generator just for this though... and in ///?!
Instead, I interpreted the Print
instruction very literally, as a good minion should. Everything after Print
is outputted:
*
Prints "Hello World"
*
→ "Hello World"
, yes, even with the quotation marks. Otherwise, I'd admit to being aware of the quotation-marks-denote-literal-string convention, which wasn't explicitly stated in the question, and doesn't exist in the language with which I'm submitting. And then I wouldn't be able to cheat with the "Print a random number" part. So, I'm feigning ignorance... Shhh, don't tell!
*
Prints a random number between 0 and 2,147,483,647
*
→ a random number between 0 and 0
. Lucky for me, although they didn't add the whole non-deterministic, different-number-every-time shtick in the rules, they did say "if our language's integer maximum is smaller than 2,147,483,647" we can use our language's "integer maximum" instead, so I did... There are no integer types in ///, only strings. So the integer maximum is 0
, sort of...
Well, it shaves off a few bytes!
*+*
Runs Forever
*+*
→
. There's no Print
instruction in this one so I can interpret it like a normal human. Replacing a pattern with itself (or another string containing itself), is the standard way to loop forever, and it's as succinct as it gets!
Note
To golf it a bit, /// looks for +*
& *
rather than the whole thing. This works just as well. For the infinite loop, nothing ever prints because the replacing never stops, so you'll never find out that it's prepending an infinitely long list of *
to the beginning every time it replaces. As for printing 'a random number,' we just don't replace one of the spaces, leaving a trailing space at the end of the output. Luckily, this hurts no one and is not noticeable. Plus, how's an ignoramus like me to know how many of the trailing spaces at the end of the Print
instruction, until the margin, were on purpose :p
0
and2,147,483,647
', is that inclusive or exclusive? (E.g., is0
a valid output?) \$\endgroup\$-1
from me. \$\endgroup\$